diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 9782cf3..f8102bc 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,13 +1,11 @@ +# Not actually used by the devcontainer, but it is used by gitpod ARG VARIANT=17-bullseye FROM mcr.microsoft.com/vscode/devcontainers/java:0-${VARIANT} - ARG NODE_VERSION="none" RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi - ARG USER=vscode VOLUME /home/$USER/.m2 VOLUME /home/$USER/.gradle - -ARG JAVA_VERSION=17.0.4.1-ms +ARG JAVA_VERSION=17.0.7-ms RUN sudo mkdir /home/$USER/.m2 /home/$USER/.gradle && sudo chown $USER:$USER /home/$USER/.m2 /home/$USER/.gradle -RUN bash -lc '. /usr/local/sdkman/bin/sdkman-init.sh && sdk install java $JAVA_VERSION && sdk use java $JAVA_VERSION' +RUN bash -lc '. /usr/local/sdkman/bin/sdkman-init.sh && sdk install java $JAVA_VERSION && sdk use java $JAVA_VERSION' \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 138b7ca..3aa67af 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,32 +1,25 @@ { - "name": "Petclinic", - "dockerFile": "Dockerfile", - "runArgs": [ - "--cap-add=SYS_PTRACE", - "--security-opt", - "seccomp=unconfined", - "--mount", - "type=bind,source=${env:HOME}/.m2,target=/home/vscode/.m2", - "--mount", - "type=bind,source=${env:HOME}/.gradle,target=/home/vscode/.gradle", - "--env", - "GRADLE_USER_HOME=/home/vscode/.gradle" - ], - "initializeCommand": "mkdir -p ${env:HOME}/.m2 ${env:HOME}/.gradle", - "postCreateCommand": "sudo chown vscode:vscode /home/vscode/.m2 /home/vscode/.gradle", - "remoteUser": "vscode", - "features": { - "docker-in-docker": "latest" - }, - "extensions": [ - "vscjava.vscode-java-pack", - "redhat.vscode-xml", - "Pivotal.vscode-boot-dev-pack", - "mhutchie.git-graph" - ], - "forwardPorts": [8080], - "settings": { - "java.import.gradle.enabled": false, - "java.server.launchMode": "Standard" - } + "name": "Java", + "image": "mcr.microsoft.com/devcontainers/base:ubuntu", + "features": { + "ghcr.io/devcontainers/features/java:1": { + "version": "21-oracle", + "jdkDistro": "oracle" + }, + "ghcr.io/devcontainers/features/azure-cli:1": {}, + "ghcr.io/devcontainers/features/docker-in-docker:2": {}, + "ghcr.io/devcontainers/features/github-cli:1": {} + }, + + "customizations": { + "vscode": { + "settings": {}, + "extensions": [ + "redhat.vscode-xml", + "visualstudioexptteam.vscodeintellicode", + "vscjava.vscode-java-pack" + ] + } + }, + "remoteUser": "vscode" } diff --git a/.editorconfig b/.editorconfig index 2513d2a..4e509a4 100644 --- a/.editorconfig +++ b/.editorconfig @@ -19,3 +19,6 @@ indent_style = space [*.{html,sql,less}] indent_size = 2 + +[*.gradle] +indent_size = 2 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..31f1bf5 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +mvnw text eol=lf +*.java text eol=lf + +/gradlew text eol=lf +*.bat text eol=crlf diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml index 13bf81a..a1ec4da 100644 --- a/.github/workflows/maven-build.yml +++ b/.github/workflows/maven-build.yml @@ -1,5 +1,5 @@ # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven +# For more information see: https://docs.github.com/en/actions/use-cases-and-examples/building-and-testing/building-and-testing-java-with-maven name: Java CI with Maven @@ -15,15 +15,15 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - java: [ '8', '11', '17' ] + java: [ '17' ] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up JDK ${{matrix.java}} - uses: actions/setup-java@v2 + uses: actions/setup-java@v4 with: java-version: ${{matrix.java}} distribution: 'adopt' cache: maven - name: Build with Maven Wrapper - run: ./mvnw -B package + run: ./mvnw -B verify diff --git a/.gitignore b/.gitignore index af0cb9b..d2767ad 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,51 @@ -target/* -bin/* -build/* -.gradle/* -.settings/* -.classpath -.project -.factorypath +HELP.md +pom.xml.bak +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ +.gradle +build/ +!gradle/wrapper/gradle-wrapper.jar +!**/src/main/**/build/ +!**/src/test/**/build/ + +### STS ### .attach_pid* +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### IntelliJ IDEA ### .idea +*.iws *.iml -/target -.sts4-cache/ -.vscode +*.ipr +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### SDK Man ### +.sdkmanrc + +### CSS ### _site/ *.css !petclinic.css diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java deleted file mode 100644 index 89964d1..0000000 --- a/.mvn/wrapper/MavenWrapperDownloader.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2007-present the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0' - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import java.net.*; -import java.io.*; -import java.nio.channels.*; -import java.util.Properties; - -public class MavenWrapperDownloader { - - private static final String WRAPPER_VERSION = "0.5.6"; - /** - * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. - */ - private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" - + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; - - /** - * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to - * use instead of the default one. - */ - private static final String MAVEN_WRAPPER_PROPERTIES_PATH = - ".mvn/wrapper/maven-wrapper.properties"; - - /** - * Path where the maven-wrapper.jar will be saved to. - */ - private static final String MAVEN_WRAPPER_JAR_PATH = - ".mvn/wrapper/maven-wrapper.jar"; - - /** - * Name of the property which should be used to override the default download url for the wrapper. - */ - private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; - - public static void main(String args[]) { - System.out.println("- Downloader started"); - File baseDirectory = new File(args[0]); - System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); - - // If the maven-wrapper.properties exists, read it and check if it contains a custom - // wrapperUrl parameter. - File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); - String url = DEFAULT_DOWNLOAD_URL; - if(mavenWrapperPropertyFile.exists()) { - FileInputStream mavenWrapperPropertyFileInputStream = null; - try { - mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); - Properties mavenWrapperProperties = new Properties(); - mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); - url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); - } catch (IOException e) { - System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); - } finally { - try { - if(mavenWrapperPropertyFileInputStream != null) { - mavenWrapperPropertyFileInputStream.close(); - } - } catch (IOException e) { - // Ignore ... - } - } - } - System.out.println("- Downloading from: " + url); - - File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); - if(!outputFile.getParentFile().exists()) { - if(!outputFile.getParentFile().mkdirs()) { - System.out.println( - "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); - } - } - System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); - try { - downloadFileFromURL(url, outputFile); - System.out.println("Done"); - System.exit(0); - } catch (Throwable e) { - System.out.println("- Error downloading"); - e.printStackTrace(); - System.exit(1); - } - } - - private static void downloadFileFromURL(String urlString, File destination) throws Exception { - if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { - String username = System.getenv("MVNW_USERNAME"); - char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); - Authenticator.setDefault(new Authenticator() { - @Override - protected PasswordAuthentication getPasswordAuthentication() { - return new PasswordAuthentication(username, password); - } - }); - } - URL website = new URL(urlString); - ReadableByteChannel rbc; - rbc = Channels.newChannel(website.openStream()); - FileOutputStream fos = new FileOutputStream(destination); - fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); - fos.close(); - rbc.close(); - } - -} diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 2cc7d4a..0000000 Binary files a/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index 4be2349..654af46 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1,3 +1,19 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.2/apache-maven-3.8.2-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar - +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +wrapperVersion=3.3.2 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip diff --git a/.springjavaformatconfig b/.springjavaformatconfig deleted file mode 100644 index 1264378..0000000 --- a/.springjavaformatconfig +++ /dev/null @@ -1 +0,0 @@ -java-baseline=8 \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..f159401 --- /dev/null +++ b/README.md @@ -0,0 +1,162 @@ +# Spring PetClinic Sample Application [![Build Status](https://github.com/spring-projects/spring-petclinic/actions/workflows/maven-build.yml/badge.svg)](https://github.com/spring-projects/spring-petclinic/actions/workflows/maven-build.yml)[![Build Status](https://github.com/spring-projects/spring-petclinic/actions/workflows/gradle-build.yml/badge.svg)](https://github.com/spring-projects/spring-petclinic/actions/workflows/gradle-build.yml) + +[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/spring-projects/spring-petclinic) [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=7517918) + +## Understanding the Spring Petclinic application with a few diagrams + +[See the presentation here](https://speakerdeck.com/michaelisvy/spring-petclinic-sample-application) + +## Run Petclinic locally + +Spring Petclinic is a [Spring Boot](https://spring.io/guides/gs/spring-boot) application built using [Maven](https://spring.io/guides/gs/maven/) or [Gradle](https://spring.io/guides/gs/gradle/). You can build a jar file and run it from the command line (it should work just as well with Java 17 or newer): + +```bash +git clone https://github.com/spring-projects/spring-petclinic.git +cd spring-petclinic +./mvnw package +java -jar target/*.jar +``` + +You can then access the Petclinic at . + +petclinic-screenshot + +Or you can run it from Maven directly using the Spring Boot Maven plugin. If you do this, it will pick up changes that you make in the project immediately (changes to Java source files require a compile as well - most people use an IDE for this): + +```bash +./mvnw spring-boot:run +``` + +> NOTE: If you prefer to use Gradle, you can build the app using `./gradlew build` and look for the jar file in `build/libs`. + +## Building a Container + +There is no `Dockerfile` in this project. You can build a container image (if you have a docker daemon) using the Spring Boot build plugin: + +```bash +./mvnw spring-boot:build-image +``` + +## In case you find a bug/suggested improvement for Spring Petclinic + +Our issue tracker is available [here](https://github.com/spring-projects/spring-petclinic/issues). + +## Database configuration + +In its default configuration, Petclinic uses an in-memory database (H2) which +gets populated at startup with data. The h2 console is exposed at `http://localhost:8080/h2-console`, +and it is possible to inspect the content of the database using the `jdbc:h2:mem:` URL. The UUID is printed at startup to the console. + +A similar setup is provided for MySQL and PostgreSQL if a persistent database configuration is needed. Note that whenever the database type changes, the app needs to run with a different profile: `spring.profiles.active=mysql` for MySQL or `spring.profiles.active=postgres` for PostgreSQL. See the [Spring Boot documentation](https://docs.spring.io/spring-boot/how-to/properties-and-configuration.html#howto.properties-and-configuration.set-active-spring-profiles) for more detail on how to set the active profile. + +You can start MySQL or PostgreSQL locally with whatever installer works for your OS or use docker: + +```bash +docker run -e MYSQL_USER=petclinic -e MYSQL_PASSWORD=petclinic -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=petclinic -p 3306:3306 mysql:9.1 +``` + +or + +```bash +docker run -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:17.0 +``` + +Further documentation is provided for [MySQL](https://github.com/spring-projects/spring-petclinic/blob/main/src/main/resources/db/mysql/petclinic_db_setup_mysql.txt) +and [PostgreSQL](https://github.com/spring-projects/spring-petclinic/blob/main/src/main/resources/db/postgres/petclinic_db_setup_postgres.txt). + +Instead of vanilla `docker` you can also use the provided `docker-compose.yml` file to start the database containers. Each one has a service named after the Spring profile: + +```bash +docker compose up mysql +``` + +or + +```bash +docker compose up postgres +``` + +## Test Applications + +At development time we recommend you use the test applications set up as `main()` methods in `PetClinicIntegrationTests` (using the default H2 database and also adding Spring Boot Devtools), `MySqlTestApplication` and `PostgresIntegrationTests`. These are set up so that you can run the apps in your IDE to get fast feedback and also run the same classes as integration tests against the respective database. The MySql integration tests use Testcontainers to start the database in a Docker container, and the Postgres tests use Docker Compose to do the same thing. + +## Compiling the CSS + +There is a `petclinic.css` in `src/main/resources/static/resources/css`. It was generated from the `petclinic.scss` source, combined with the [Bootstrap](https://getbootstrap.com/) library. If you make changes to the `scss`, or upgrade Bootstrap, you will need to re-compile the CSS resources using the Maven profile "css", i.e. `./mvnw package -P css`. There is no build profile for Gradle to compile the CSS. + +## Working with Petclinic in your IDE + +### Prerequisites + +The following items should be installed in your system: + +- Java 17 or newer (full JDK, not a JRE) +- [Git command line tool](https://help.github.com/articles/set-up-git) +- Your preferred IDE + - Eclipse with the m2e plugin. Note: when m2e is available, there is an m2 icon in `Help -> About` dialog. If m2e is + not there, follow the install process [here](https://www.eclipse.org/m2e/) + - [Spring Tools Suite](https://spring.io/tools) (STS) + - [IntelliJ IDEA](https://www.jetbrains.com/idea/) + - [VS Code](https://code.visualstudio.com) + +### Steps + +1. On the command line run: + + ```bash + git clone https://github.com/spring-projects/spring-petclinic.git + ``` + +1. Inside Eclipse or STS: + + Open the project via `File -> Import -> Maven -> Existing Maven project`, then select the root directory of the cloned repo. + + Then either build on the command line `./mvnw generate-resources` or use the Eclipse launcher (right-click on project and `Run As -> Maven install`) to generate the CSS. Run the application's main method by right-clicking on it and choosing `Run As -> Java Application`. + +1. Inside IntelliJ IDEA: + + In the main menu, choose `File -> Open` and select the Petclinic [pom.xml](pom.xml). Click on the `Open` button. + + - CSS files are generated from the Maven build. You can build them on the command line `./mvnw generate-resources` or right-click on the `spring-petclinic` project then `Maven -> Generates sources and Update Folders`. + + - A run configuration named `PetClinicApplication` should have been created for you if you're using a recent Ultimate version. Otherwise, run the application by right-clicking on the `PetClinicApplication` main class and choosing `Run 'PetClinicApplication'`. + +1. Navigate to the Petclinic + + Visit [http://localhost:8080](http://localhost:8080) in your browser. + +## Looking for something in particular? + +|Spring Boot Configuration | Class or Java property files | +|--------------------------|---| +|The Main Class | [PetClinicApplication](https://github.com/spring-projects/spring-petclinic/blob/main/src/main/java/org/springframework/samples/petclinic/PetClinicApplication.java) | +|Properties Files | [application.properties](https://github.com/spring-projects/spring-petclinic/blob/main/src/main/resources) | +|Caching | [CacheConfiguration](https://github.com/spring-projects/spring-petclinic/blob/main/src/main/java/org/springframework/samples/petclinic/system/CacheConfiguration.java) | + +## Interesting Spring Petclinic branches and forks + +The Spring Petclinic "main" branch in the [spring-projects](https://github.com/spring-projects/spring-petclinic) +GitHub org is the "canonical" implementation based on Spring Boot and Thymeleaf. There are +[quite a few forks](https://spring-petclinic.github.io/docs/forks.html) in the GitHub org +[spring-petclinic](https://github.com/spring-petclinic). If you are interested in using a different technology stack to implement the Pet Clinic, please join the community there. + +## Interaction with other open-source projects + +One of the best parts about working on the Spring Petclinic application is that we have the opportunity to work in direct contact with many Open Source projects. We found bugs/suggested improvements on various topics such as Spring, Spring Data, Bean Validation and even Eclipse! In many cases, they've been fixed/implemented in just a few days. +Here is a list of them: + +| Name | Issue | +|------|-------| +| Spring JDBC: simplify usage of NamedParameterJdbcTemplate | [SPR-10256](https://jira.springsource.org/browse/SPR-10256) and [SPR-10257](https://jira.springsource.org/browse/SPR-10257) | +| Bean Validation / Hibernate Validator: simplify Maven dependencies and backward compatibility |[HV-790](https://hibernate.atlassian.net/browse/HV-790) and [HV-792](https://hibernate.atlassian.net/browse/HV-792) | +| Spring Data: provide more flexibility when working with JPQL queries | [DATAJPA-292](https://jira.springsource.org/browse/DATAJPA-292) | + +## Contributing + +The [issue tracker](https://github.com/spring-projects/spring-petclinic/issues) is the preferred channel for bug reports, feature requests and submitting pull requests. + +For pull requests, editor preferences are available in the [editor config](.editorconfig) for easy use in common text editors. Read more and download plugins at . If you have not previously done so, please fill out and submit the [Contributor License Agreement](https://cla.pivotal.io/sign/spring). + +## License + +The Spring PetClinic sample application is released under version 2.0 of the [Apache License](https://www.apache.org/licenses/LICENSE-2.0). diff --git a/build.gradle b/build.gradle index 5f62c06..36de758 100644 --- a/build.gradle +++ b/build.gradle @@ -1,40 +1,91 @@ plugins { - id 'org.springframework.boot' version '2.7.3' - id 'io.spring.dependency-management' version '1.0.13.RELEASE' id 'java' + id 'org.springframework.boot' version '3.4.0' + id 'io.spring.dependency-management' version '1.1.6' + id 'org.graalvm.buildtools.native' version '0.10.3' + id 'org.cyclonedx.bom' version '1.10.0' + id 'io.spring.javaformat' version '0.0.43' + id "io.spring.nohttp" version "0.0.11" } apply plugin: 'java' +apply plugin: 'checkstyle' +apply plugin: 'io.spring.javaformat' + +gradle.startParameter.excludedTaskNames += [ "checkFormatAot", "checkFormatAotTest" ] group = 'org.springframework.samples' -version = '2.7.3' -sourceCompatibility = '11' +version = '3.4.0' + +java { + sourceCompatibility = JavaVersion.VERSION_17 +} repositories { mavenCentral() } +ext.checkstyleVersion = "10.20.1" +ext.springJavaformatCheckstyleVersion = "0.0.43" +ext.webjarsLocatorLiteVersion = "1.0.1" ext.webjarsFontawesomeVersion = "4.7.0" -ext.webjarsBootstrapVersion = "5.1.3" +ext.webjarsBootstrapVersion = "5.3.3" dependencies { + // Workaround for AOT issue (https://github.com/spring-projects/spring-framework/pull/33949) --> + implementation 'io.projectreactor:reactor-core' + implementation 'org.springframework.boot:spring-boot-starter-cache' implementation 'org.springframework.boot:spring-boot-starter-data-jpa' implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-validation' + implementation 'io.micrometer:micrometer-registry-prometheus' implementation 'javax.cache:cache-api' + implementation 'jakarta.xml.bind:jakarta.xml.bind-api' runtimeOnly 'org.springframework.boot:spring-boot-starter-actuator' + runtimeOnly "org.webjars:webjars-locator-lite:${webjarsLocatorLiteVersion}" runtimeOnly "org.webjars.npm:bootstrap:${webjarsBootstrapVersion}" runtimeOnly "org.webjars.npm:font-awesome:${webjarsFontawesomeVersion}" - runtimeOnly 'org.ehcache:ehcache' + runtimeOnly 'com.github.ben-manes.caffeine:caffeine' runtimeOnly 'com.h2database:h2' - runtimeOnly 'mysql:mysql-connector-java' + runtimeOnly 'com.mysql:mysql-connector-j' runtimeOnly 'org.postgresql:postgresql' developmentOnly 'org.springframework.boot:spring-boot-devtools' testImplementation 'org.springframework.boot:spring-boot-starter-test' + testImplementation 'org.springframework.boot:spring-boot-testcontainers' + testImplementation 'org.springframework.boot:spring-boot-docker-compose' + testImplementation 'org.testcontainers:junit-jupiter' + testImplementation 'org.testcontainers:mysql' + checkstyle "io.spring.javaformat:spring-javaformat-checkstyle:${springJavaformatCheckstyleVersion}" + checkstyle "com.puppycrawl.tools:checkstyle:${checkstyleVersion}" } tasks.named('test') { useJUnitPlatform() } + +checkstyle { + configDirectory = project.file('src/checkstyle') + configFile = file('src/checkstyle/nohttp-checkstyle.xml') +} + +checkstyleNohttp { + configDirectory = project.file('src/checkstyle') + configFile = file('src/checkstyle/nohttp-checkstyle.xml') +} + +tasks.named("formatMain").configure { dependsOn("checkstyleMain") } +tasks.named("formatMain").configure { dependsOn("checkstyleNohttp") } + +tasks.named("formatTest").configure { dependsOn("checkstyleTest") } +tasks.named("formatTest").configure { dependsOn("checkstyleNohttp") } + +checkstyleAot.enabled = false +checkstyleAotTest.enabled = false + +checkFormatAot.enabled = false +checkFormatAotTest.enabled = false + +formatAot.enabled = false +formatAotTest.enabled = false diff --git a/docker-compose.yml b/docker-compose.yml index 4c81a82..47579bb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,8 +1,6 @@ -version: "2.2" - services: mysql: - image: mysql:5.7 + image: mysql:9.1 ports: - "3306:3306" environment: @@ -14,7 +12,7 @@ services: volumes: - "./conf.d:/etc/mysql/conf.d:ro" postgres: - image: postgres:14.1 + image: postgres:17.0 ports: - "5432:5432" environment: diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180..a4b76b9 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ae04661..df97d72 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c787..f5feea6 100755 --- a/gradlew +++ b/gradlew @@ -15,6 +15,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +# SPDX-License-Identifier: Apache-2.0 +# ############################################################################## # @@ -55,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,13 +82,12 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,22 +134,29 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -193,11 +201,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ @@ -205,6 +217,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index ac1b06f..9d21a21 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,89 +1,94 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/k8s/db.yml b/k8s/db.yml new file mode 100644 index 0000000..c230ddb --- /dev/null +++ b/k8s/db.yml @@ -0,0 +1,73 @@ +--- +apiVersion: v1 +kind: Secret +metadata: + name: demo-db +type: servicebinding.io/postgresql +stringData: + type: "postgresql" + provider: "postgresql" + host: "demo-db" + port: "5432" + database: "petclinic" + username: "user" + password: "pass" + +--- +apiVersion: v1 +kind: Service +metadata: + name: demo-db +spec: + ports: + - port: 5432 + selector: + app: demo-db + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: demo-db + labels: + app: demo-db +spec: + selector: + matchLabels: + app: demo-db + template: + metadata: + labels: + app: demo-db + spec: + containers: + - image: postgres:17 + name: postgresql + env: + - name: POSTGRES_USER + valueFrom: + secretKeyRef: + name: demo-db + key: username + - name: POSTGRES_PASSWORD + valueFrom: + secretKeyRef: + name: demo-db + key: password + - name: POSTGRES_DB + valueFrom: + secretKeyRef: + name: demo-db + key: database + ports: + - containerPort: 5432 + name: postgresql + livenessProbe: + tcpSocket: + port: postgresql + readinessProbe: + tcpSocket: + port: postgresql + startupProbe: + tcpSocket: + port: postgresql diff --git a/k8s/petclinic.yml b/k8s/petclinic.yml new file mode 100644 index 0000000..a5677cd --- /dev/null +++ b/k8s/petclinic.yml @@ -0,0 +1,64 @@ +--- +apiVersion: v1 +kind: Service +metadata: + name: petclinic +spec: + type: NodePort + ports: + - port: 80 + targetPort: 8080 + selector: + app: petclinic + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: petclinic + labels: + app: petclinic +spec: + replicas: 1 + selector: + matchLabels: + app: petclinic + template: + metadata: + labels: + app: petclinic + spec: + containers: + - name: workload + image: dsyer/petclinic + env: + - name: SPRING_PROFILES_ACTIVE + value: postgres + - name: SERVICE_BINDING_ROOT + value: /bindings + - name: SPRING_APPLICATION_JSON + value: | + { + "management.endpoint.health.probes.add-additional-paths": true + } + ports: + - name: http + containerPort: 8080 + livenessProbe: + httpGet: + path: /livez + port: http + readinessProbe: + httpGet: + path: /readyz + port: http + volumeMounts: + - mountPath: /bindings/secret + name: binding + readOnly: true + volumes: + - name: binding + projected: + sources: + - secret: + name: demo-db diff --git a/mvnw b/mvnw index 2c90d17..d7c358e 100755 --- a/mvnw +++ b/mvnw @@ -8,7 +8,7 @@ # "License"); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # -# https://www.apache.org/licenses/LICENSE-2.0' +# https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an @@ -19,292 +19,241 @@ # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- -# Maven Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir +# Apache Maven Wrapper startup batch script, version 3.3.2 # # Optional ENV vars # ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output # ---------------------------------------------------------------------------- -if [ -z "$MAVEN_SKIP_RC" ] ; then +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; esac -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Mingw, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then # IBM's JDK on AIX uses strange locations for the executables JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" else JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" + + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 + fi fi else - JAVACMD="`which java`" - fi -fi + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround + fi +} + +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" done - echo "${basedir}" + printf %x\\n $h } -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } + +die() { + printf %s\\n "$1" >&2 + exit 1 } -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} + +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" fi -########################################################################################## -# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -# This allows using the maven wrapper in projects that prohibit checking in binary data. -########################################################################################## -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found .mvn/wrapper/maven-wrapper.jar" - fi +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac + +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." - fi - if [ -n "$MVNW_REPOURL" ]; then - jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" - else - jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" - fi - while IFS="=" read key value; do - case "$key" in (wrapperUrl) jarUrl="$value"; break ;; - esac - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Downloading from: $jarUrl" - fi - wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" - if $cygwin; then - wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` - fi - - if command -v wget > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found wget ... using wget" - fi - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - wget "$jarUrl" -O "$wrapperJarPath" - else - wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" - fi - elif command -v curl > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found curl ... using curl" - fi - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - curl -o "$wrapperJarPath" "$jarUrl" -f - else - curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f - fi - - else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Falling back to using Java to download" - fi - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - # For Cygwin, switch paths to Windows format before running javac - if $cygwin; then - javaClass=`cygpath --path --windows "$javaClass"` - fi - if [ -e "$javaClass" ]; then - if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Compiling MavenWrapperDownloader.java ..." - fi - # Compiling the Java class - ("$JAVA_HOME/bin/javac" "$javaClass") - fi - if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - # Running the downloader - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Running MavenWrapperDownloader.java ..." - fi - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") - fi - fi - fi -fi -########################################################################################## -# End of extension -########################################################################################## - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -if [ "$MVNW_VERBOSE" = true ]; then - echo $MAVEN_PROJECTBASEDIR -fi -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` + die "cannot create temp dir" fi -# Provide a "standardized" way to retrieve the CLI args that will -# work with both Windows and non-Windows executions. -MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" -export MAVEN_CMD_LINE_ARGS +mkdir -p -- "${MAVEN_HOME%/*}" -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" +fi + +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v + +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac + +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true + fi + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 + fi +fi + +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" +else + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" + +clean || : +exec_maven "$@" diff --git a/mvnw.cmd b/mvnw.cmd index 0d34af4..6f779cf 100644 --- a/mvnw.cmd +++ b/mvnw.cmd @@ -1,3 +1,4 @@ +<# : batch portion @REM ---------------------------------------------------------------------------- @REM Licensed to the Apache Software Foundation (ASF) under one @REM or more contributor license agreements. See the NOTICE file @@ -7,7 +8,7 @@ @REM "License"); you may not use this file except in compliance @REM with the License. You may obtain a copy of the License at @REM -@REM https://www.apache.org/licenses/LICENSE-2.0' +@REM https://www.apache.org/licenses/LICENSE-2.0 @REM @REM Unless required by applicable law or agreed to in writing, @REM software distributed under the License is distributed on an @@ -18,165 +19,131 @@ @REM ---------------------------------------------------------------------------- @REM ---------------------------------------------------------------------------- -@REM Maven Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir +@REM Apache Maven Wrapper startup batch script, version 3.3.2 @REM @REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output @REM ---------------------------------------------------------------------------- -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" - -FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) ) +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" (%__MVNW_CMD__% %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> -@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -@REM This allows using the maven wrapper in projects that prohibit checking in binary data. -if exist %WRAPPER_JAR% ( - if "%MVNW_VERBOSE%" == "true" ( - echo Found %WRAPPER_JAR% - ) -) else ( - if not "%MVNW_REPOURL%" == "" ( - SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" - ) - if "%MVNW_VERBOSE%" == "true" ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %DOWNLOAD_URL% - ) +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} - powershell -Command "&{"^ - "$webclient = new-object System.Net.WebClient;"^ - "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ - "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ - "}"^ - "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ - "}" - if "%MVNW_VERBOSE%" == "true" ( - echo Finished downloading %WRAPPER_JAR% - ) -) -@REM End of extension +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} -@REM Provide a "standardized" way to retrieve the CLI args that will -@REM work with both Windows and non-Windows executions. -set MAVEN_CMD_LINE_ARGS=%* +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace '^.*'+$MVNW_REPO_PATTERN,'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' +$MAVEN_HOME_PARENT = "$HOME/.m2/wrapper/dists/$distributionUrlNameMain" +if ($env:MAVEN_USER_HOME) { + $MAVEN_HOME_PARENT = "$env:MAVEN_USER_HOME/wrapper/dists/$distributionUrlNameMain" +} +$MAVEN_HOME_NAME = ([System.Security.Cryptography.MD5]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" -:error -set ERROR_CODE=1 +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" -exit /B %ERROR_CODE% +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/pom.xml b/pom.xml index 4de642c..ef2dbcc 100644 --- a/pom.xml +++ b/pom.xml @@ -1,15 +1,18 @@ - + 4.0.0 - org.springframework.samples - spring-petclinic - 3.0.0-SNAPSHOT org.springframework.boot spring-boot-starter-parent - 3.0.0-RC1 + 3.4.0 + + + org.springframework.samples + spring-petclinic + 3.4.0-SNAPSHOT + petclinic @@ -18,14 +21,22 @@ 17 UTF-8 UTF-8 + + 2024-11-28T14:37:52Z - 5.1.3 + 1.0.1 + 5.3.3 4.7.0 - 0.8.7 - 0.0.10 - 0.0.31 + 10.20.1 + 0.8.12 + 0.2.29 + 1.0.0 + 3.6.0 + 0.0.11 + 0.0.43 @@ -60,6 +71,11 @@ spring-boot-starter-test test + + + io.projectreactor + reactor-core + @@ -68,8 +84,8 @@ runtime - mysql - mysql-connector-java + com.mysql + mysql-connector-j runtime @@ -78,7 +94,7 @@ runtime - + javax.cache cache-api @@ -88,7 +104,12 @@ caffeine - + + + org.webjars + webjars-locator-lite + ${webjars-locator.version} + org.webjars.npm bootstrap @@ -99,12 +120,31 @@ font-awesome ${webjars-font-awesome.version} - org.springframework.boot spring-boot-devtools - true + test + + + org.springframework.boot + spring-boot-testcontainers + test + + + org.springframework.boot + spring-boot-docker-compose + test + + + org.testcontainers + junit-jupiter + test + + + org.testcontainers + mysql + test @@ -112,32 +152,59 @@ jakarta.xml.bind-api + + io.micrometer + micrometer-registry-prometheus + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + enforce-java + + enforce + + + + + This build requires at least Java ${java.version}, + update your JVM, and + run the build again + ${java.version} + + + + + + io.spring.javaformat spring-javaformat-maven-plugin ${spring-format.version} - validate validate + validate org.apache.maven.plugins maven-checkstyle-plugin - 3.1.2 + ${maven-checkstyle.version} com.puppycrawl.tools checkstyle - 8.45.1 + ${checkstyle.version} io.spring.nohttp @@ -148,21 +215,24 @@ nohttp-checkstyle-validation - validate - - src/checkstyle/nohttp-checkstyle.xml - src/checkstyle/nohttp-checkstyle-suppressions.xml - UTF-8 - ${basedir} - **/* - **/.git/**/*,**/.idea/**/*,**/target/**/,**/.flattened-pom.xml,**/*.class - check + validate + + src/checkstyle/nohttp-checkstyle.xml + ${basedir} + **/* + **/.git/**/*,**/.idea/**/*,**/target/**/,**/.flattened-pom.xml,**/*.class + config_loc=${basedir}/src/checkstyle/ + + + org.graalvm.buildtools + native-maven-plugin + org.springframework.boot spring-boot-maven-plugin @@ -177,8 +247,8 @@ ${project.build.sourceEncoding} ${project.reporting.outputEncoding} - ${maven.compiler.source} - ${maven.compiler.target} + ${java.version} + ${java.version} @@ -196,40 +266,34 @@ report - prepare-package report + prepare-package - + - pl.project13.maven - git-commit-id-plugin - - - - revision - - - + io.github.git-commit-id + git-commit-id-maven-plugin - true - yyyy-MM-dd'T'HH:mm:ssZ - true - ${project.build.outputDirectory}/git.properties - false false + + + + org.cyclonedx + cyclonedx-maven-plugin + - Apache License, Version 2.0 @@ -239,39 +303,38 @@ - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot true + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot - spring-milestones - Spring Milestones - https://repo.spring.io/milestone false + spring-milestones + Spring Milestones + https://repo.spring.io/milestone - - spring-snapshots - Spring Snapshots - https://repo.spring.io/snapshot true + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot - spring-milestones - Spring Milestones - https://repo.spring.io/milestone false + spring-milestones + Spring Milestones + https://repo.spring.io/milestone @@ -286,11 +349,11 @@ unpack - - generate-resources unpack + + generate-resources @@ -308,21 +371,21 @@ com.gitlab.haynes libsass-maven-plugin - 0.2.26 - - - generate-resources - - - compile - - - + ${libsass.version} ${basedir}/src/main/scss/ ${basedir}/src/main/resources/static/resources/css/ ${project.build.directory}/webjars/META-INF/resources/webjars/bootstrap/${webjars-bootstrap.version}/scss/ + + + + + compile + + generate-resources + + @@ -338,11 +401,11 @@ + only. It has no influence on the Maven build itself. --> org.eclipse.m2e lifecycle-mapping - 1.0.0 + ${lifecycle-mapping} @@ -356,7 +419,7 @@ - + @@ -369,7 +432,7 @@ - + @@ -382,7 +445,7 @@ - + @@ -394,5 +457,4 @@ - diff --git a/readme.md b/readme.md deleted file mode 100644 index 8ee8848..0000000 --- a/readme.md +++ /dev/null @@ -1,158 +0,0 @@ -# Spring PetClinic Sample Application [![Build Status](https://github.com/spring-projects/spring-petclinic/actions/workflows/maven-build.yml/badge.svg)](https://github.com/spring-projects/spring-petclinic/actions/workflows/maven-build.yml) - -[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/spring-projects/spring-petclinic) - -## Understanding the Spring Petclinic application with a few diagrams -See the presentation here - -## Running petclinic locally -Petclinic is a [Spring Boot](https://spring.io/guides/gs/spring-boot) application built using [Maven](https://spring.io/guides/gs/maven/) or [Gradle](https://spring.io/guides/gs/gradle/). You can build a jar file and run it from the command line (it should work just as well with Java 11 or newer): - - -``` -git clone https://github.com/spring-projects/spring-petclinic.git -cd spring-petclinic -./mvnw package -java -jar target/*.jar -``` - -You can then access petclinic here: http://localhost:8080/ - -petclinic-screenshot - -Or you can run it from Maven directly using the Spring Boot Maven plugin. If you do this it will pick up changes that you make in the project immediately (changes to Java source files require a compile as well - most people use an IDE for this): - -``` -./mvnw spring-boot:run -``` - -> NOTE: Windows users should set `git config core.autocrlf true` to avoid format assertions failing the build (use `--global` to set that flag globally). - -> NOTE: If you prefer to use Gradle, you can build the app using `./gradlew build` and look for the jar file in `build/libs`. - -## Building a Container - -There is no `Dockerfile` in this project. You can build a container image (if you have a docker daemon) using the Spring Boot build plugin: - -``` -./mvnw spring-boot:build-image -``` - -## In case you find a bug/suggested improvement for Spring Petclinic -Our issue tracker is available here: https://github.com/spring-projects/spring-petclinic/issues - - -## Database configuration - -In its default configuration, Petclinic uses an in-memory database (H2) which -gets populated at startup with data. The h2 console is automatically exposed at `http://localhost:8080/h2-console` -and it is possible to inspect the content of the database using the `jdbc:h2:mem:testdb` url. - -A similar setup is provided for MySQL and PostgreSQL in case a persistent database configuration is needed. Note that whenever the database type is changed, the app needs to be run with a different profile: `spring.profiles.active=mysql` for MySQL or `spring.profiles.active=postgres` for PostgreSQL. - -You could start MySQL or PostgreSQL locally with whatever installer works for your OS, or with docker: - -``` -docker run -e MYSQL_USER=petclinic -e MYSQL_PASSWORD=petclinic -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=petclinic -p 3306:3306 mysql:5.7.8 -``` - -or - -``` -docker run -e POSTGRES_USER=petclinic -e POSTGRES_PASSWORD=petclinic -e POSTGRES_DB=petclinic -p 5432:5432 postgres:14.1 -``` - -Further documentation is provided for [MySQL](https://github.com/spring-projects/spring-petclinic/blob/main/src/main/resources/db/mysql/petclinic_db_setup_mysql.txt) -and for [PostgreSQL](https://github.com/spring-projects/spring-petclinic/blob/main/src/main/resources/db/postgres/petclinic_db_setup_postgres.txt). - -## Compiling the CSS - -There is a `petclinic.css` in `src/main/resources/static/resources/css`. It was generated from the `petclinic.scss` source, combined with the [Bootstrap](https://getbootstrap.com/) library. If you make changes to the `scss`, or upgrade Bootstrap, you will need to re-compile the CSS resources using the Maven profile "css", i.e. `./mvnw package -P css`. There is no build profile for Gradle to compile the CSS. - -## Working with Petclinic in your IDE - -### Prerequisites -The following items should be installed in your system: -* Java 11 or newer (full JDK not a JRE). -* git command line tool (https://help.github.com/articles/set-up-git) -* Your preferred IDE - * Eclipse with the m2e plugin. Note: when m2e is available, there is an m2 icon in `Help -> About` dialog. If m2e is - not there, just follow the install process here: https://www.eclipse.org/m2e/ - * [Spring Tools Suite](https://spring.io/tools) (STS) - * IntelliJ IDEA - * [VS Code](https://code.visualstudio.com) - -### Steps: - -1) On the command line - ``` - git clone https://github.com/spring-projects/spring-petclinic.git - ``` -2) Inside Eclipse or STS - ``` - File -> Import -> Maven -> Existing Maven project - ``` - - Then either build on the command line `./mvnw generate-resources` or using the Eclipse launcher (right click on project and `Run As -> Maven install`) to generate the css. Run the application main method by right clicking on it and choosing `Run As -> Java Application`. - -3) Inside IntelliJ IDEA - In the main menu, choose `File -> Open` and select the Petclinic [pom.xml](pom.xml). Click on the `Open` button. - - CSS files are generated from the Maven build. You can either build them on the command line `./mvnw generate-resources` or right click on the `spring-petclinic` project then `Maven -> Generates sources and Update Folders`. - - A run configuration named `PetClinicApplication` should have been created for you if you're using a recent Ultimate version. Otherwise, run the application by right clicking on the `PetClinicApplication` main class and choosing `Run 'PetClinicApplication'`. - -4) Navigate to Petclinic - - Visit [http://localhost:8080](http://localhost:8080) in your browser. - - -## Looking for something in particular? - -|Spring Boot Configuration | Class or Java property files | -|--------------------------|---| -|The Main Class | [PetClinicApplication](https://github.com/spring-projects/spring-petclinic/blob/main/src/main/java/org/springframework/samples/petclinic/PetClinicApplication.java) | -|Properties Files | [application.properties](https://github.com/spring-projects/spring-petclinic/blob/main/src/main/resources) | -|Caching | [CacheConfiguration](https://github.com/spring-projects/spring-petclinic/blob/main/src/main/java/org/springframework/samples/petclinic/system/CacheConfiguration.java) | - -## Interesting Spring Petclinic branches and forks - -The Spring Petclinic "main" branch in the [spring-projects](https://github.com/spring-projects/spring-petclinic) -GitHub org is the "canonical" implementation, currently based on Spring Boot and Thymeleaf. There are -[quite a few forks](https://spring-petclinic.github.io/docs/forks.html) in a special GitHub org -[spring-petclinic](https://github.com/spring-petclinic). If you have a special interest in a different technology stack -that could be used to implement the Pet Clinic then please join the community there. - - -## Interaction with other open source projects - -One of the best parts about working on the Spring Petclinic application is that we have the opportunity to work in direct contact with many Open Source projects. We found some bugs/suggested improvements on various topics such as Spring, Spring Data, Bean Validation and even Eclipse! In many cases, they've been fixed/implemented in just a few days. -Here is a list of them: - -| Name | Issue | -|------|-------| -| Spring JDBC: simplify usage of NamedParameterJdbcTemplate | [SPR-10256](https://jira.springsource.org/browse/SPR-10256) and [SPR-10257](https://jira.springsource.org/browse/SPR-10257) | -| Bean Validation / Hibernate Validator: simplify Maven dependencies and backward compatibility |[HV-790](https://hibernate.atlassian.net/browse/HV-790) and [HV-792](https://hibernate.atlassian.net/browse/HV-792) | -| Spring Data: provide more flexibility when working with JPQL queries | [DATAJPA-292](https://jira.springsource.org/browse/DATAJPA-292) | - - -# Contributing - -The [issue tracker](https://github.com/spring-projects/spring-petclinic/issues) is the preferred channel for bug reports, features requests and submitting pull requests. - -For pull requests, editor preferences are available in the [editor config](.editorconfig) for easy use in common text editors. Read more and download plugins at . If you have not previously done so, please fill out and submit the [Contributor License Agreement](https://cla.pivotal.io/sign/spring). - -# License - -The Spring PetClinic sample application is released under version 2.0 of the [Apache License](https://www.apache.org/licenses/LICENSE-2.0). - -[spring-petclinic]: https://github.com/spring-projects/spring-petclinic -[spring-framework-petclinic]: https://github.com/spring-petclinic/spring-framework-petclinic -[spring-petclinic-angularjs]: https://github.com/spring-petclinic/spring-petclinic-angularjs -[javaconfig branch]: https://github.com/spring-petclinic/spring-framework-petclinic/tree/javaconfig -[spring-petclinic-angular]: https://github.com/spring-petclinic/spring-petclinic-angular -[spring-petclinic-microservices]: https://github.com/spring-petclinic/spring-petclinic-microservices -[spring-petclinic-reactjs]: https://github.com/spring-petclinic/spring-petclinic-reactjs -[spring-petclinic-graphql]: https://github.com/spring-petclinic/spring-petclinic-graphql -[spring-petclinic-kotlin]: https://github.com/spring-petclinic/spring-petclinic-kotlin -[spring-petclinic-rest]: https://github.com/spring-petclinic/spring-petclinic-rest diff --git a/src/checkstyle/nohttp-checkstyle-suppressions.xml b/src/checkstyle/nohttp-checkstyle-suppressions.xml index 58da146..f00599b 100644 --- a/src/checkstyle/nohttp-checkstyle-suppressions.xml +++ b/src/checkstyle/nohttp-checkstyle-suppressions.xml @@ -3,9 +3,9 @@ "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN" "https://checkstyle.org/dtds/suppressions_1_2.dtd"> - - - - - + + + + + diff --git a/src/checkstyle/nohttp-checkstyle.xml b/src/checkstyle/nohttp-checkstyle.xml index e620512..f886411 100644 --- a/src/checkstyle/nohttp-checkstyle.xml +++ b/src/checkstyle/nohttp-checkstyle.xml @@ -4,4 +4,7 @@ "https://checkstyle.org/dtds/configuration_1_2.dtd"> + + + diff --git a/src/main/java/org/springframework/samples/petclinic/PetClinicRuntimeHints.java b/src/main/java/org/springframework/samples/petclinic/PetClinicRuntimeHints.java index 237897d..2975923 100644 --- a/src/main/java/org/springframework/samples/petclinic/PetClinicRuntimeHints.java +++ b/src/main/java/org/springframework/samples/petclinic/PetClinicRuntimeHints.java @@ -18,13 +18,20 @@ package org.springframework.samples.petclinic; import org.springframework.aot.hint.RuntimeHints; import org.springframework.aot.hint.RuntimeHintsRegistrar; +import org.springframework.samples.petclinic.model.BaseEntity; +import org.springframework.samples.petclinic.model.Person; +import org.springframework.samples.petclinic.vet.Vet; public class PetClinicRuntimeHints implements RuntimeHintsRegistrar { @Override public void registerHints(RuntimeHints hints, ClassLoader classLoader) { hints.resources().registerPattern("db/*"); // https://github.com/spring-projects/spring-boot/issues/32654 - hints.resources().registerPattern("META-INF/resources/webjars/*"); + hints.resources().registerPattern("messages/*"); + hints.resources().registerPattern("mysql-default-conf"); + hints.serialization().registerType(BaseEntity.class); + hints.serialization().registerType(Person.class); + hints.serialization().registerType(Vet.class); } } diff --git a/src/main/java/org/springframework/samples/petclinic/model/NamedEntity.java b/src/main/java/org/springframework/samples/petclinic/model/NamedEntity.java index 7c2ccb2..012e8c4 100644 --- a/src/main/java/org/springframework/samples/petclinic/model/NamedEntity.java +++ b/src/main/java/org/springframework/samples/petclinic/model/NamedEntity.java @@ -17,6 +17,7 @@ package org.springframework.samples.petclinic.model; import jakarta.persistence.Column; import jakarta.persistence.MappedSuperclass; +import jakarta.validation.constraints.NotBlank; /** * Simple JavaBean domain object adds a name property to BaseEntity. Used as @@ -24,11 +25,13 @@ import jakarta.persistence.MappedSuperclass; * * @author Ken Krebs * @author Juergen Hoeller + * @author Wick Dynex */ @MappedSuperclass public class NamedEntity extends BaseEntity { @Column(name = "name") + @NotBlank private String name; public String getName() { diff --git a/src/main/java/org/springframework/samples/petclinic/model/Person.java b/src/main/java/org/springframework/samples/petclinic/model/Person.java index e41b6ba..7c3d81a 100644 --- a/src/main/java/org/springframework/samples/petclinic/model/Person.java +++ b/src/main/java/org/springframework/samples/petclinic/model/Person.java @@ -17,7 +17,7 @@ package org.springframework.samples.petclinic.model; import jakarta.persistence.Column; import jakarta.persistence.MappedSuperclass; -import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotBlank; /** * Simple JavaBean domain object representing an person. @@ -28,11 +28,11 @@ import jakarta.validation.constraints.NotEmpty; public class Person extends BaseEntity { @Column(name = "first_name") - @NotEmpty + @NotBlank private String firstName; @Column(name = "last_name") - @NotEmpty + @NotBlank private String lastName; public String getFirstName() { diff --git a/src/main/java/org/springframework/samples/petclinic/owner/Owner.java b/src/main/java/org/springframework/samples/petclinic/owner/Owner.java index ce3ef93..675b214 100644 --- a/src/main/java/org/springframework/samples/petclinic/owner/Owner.java +++ b/src/main/java/org/springframework/samples/petclinic/owner/Owner.java @@ -30,8 +30,8 @@ import jakarta.persistence.JoinColumn; import jakarta.persistence.OneToMany; import jakarta.persistence.OrderBy; import jakarta.persistence.Table; -import jakarta.validation.constraints.Digits; -import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.Pattern; +import jakarta.validation.constraints.NotBlank; /** * Simple JavaBean domain object representing an owner. @@ -41,28 +41,29 @@ import jakarta.validation.constraints.NotEmpty; * @author Sam Brannen * @author Michael Isvy * @author Oliver Drotbohm + * @author Wick Dynex */ @Entity @Table(name = "owners") public class Owner extends Person { @Column(name = "address") - @NotEmpty + @NotBlank private String address; @Column(name = "city") - @NotEmpty + @NotBlank private String city; @Column(name = "telephone") - @NotEmpty - @Digits(fraction = 0, integer = 10) + @NotBlank + @Pattern(regexp = "\\d{10}", message = "Telephone must be a 10-digit number") private String telephone; @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinColumn(name = "owner_id") @OrderBy("name") - private List pets = new ArrayList<>(); + private final List pets = new ArrayList<>(); public String getAddress() { return this.address; @@ -101,7 +102,7 @@ public class Owner extends Person { /** * Return the Pet with the given name, or null if none found for this Owner. * @param name to test - * @return a pet if pet name is already in use + * @return the Pet with the given name, or null if no such Pet exists for this Owner */ public Pet getPet(String name) { return getPet(name, false); @@ -109,8 +110,8 @@ public class Owner extends Person { /** * Return the Pet with the given id, or null if none found for this Owner. - * @param name to test - * @return a pet if pet id is already in use + * @param id to test + * @return the Pet with the given id, or null if no such Pet exists for this Owner */ public Pet getPet(Integer id) { for (Pet pet : getPets()) { @@ -127,15 +128,14 @@ public class Owner extends Person { /** * Return the Pet with the given name, or null if none found for this Owner. * @param name to test - * @return a pet if pet name is already in use + * @param ignoreNew whether to ignore new pets (pets that are not saved yet) + * @return the Pet with the given name, or null if no such Pet exists for this Owner */ public Pet getPet(String name, boolean ignoreNew) { - name = name.toLowerCase(); for (Pet pet : getPets()) { - if (!ignoreNew || !pet.isNew()) { - String compName = pet.getName(); - compName = compName == null ? "" : compName.toLowerCase(); - if (compName.equals(name)) { + String compName = pet.getName(); + if (compName != null && compName.equalsIgnoreCase(name)) { + if (!ignoreNew || !pet.isNew()) { return pet; } } @@ -145,10 +145,14 @@ public class Owner extends Person { @Override public String toString() { - return new ToStringCreator(this).append("id", this.getId()).append("new", this.isNew()) - .append("lastName", this.getLastName()).append("firstName", this.getFirstName()) - .append("address", this.address).append("city", this.city).append("telephone", this.telephone) - .toString(); + return new ToStringCreator(this).append("id", this.getId()) + .append("new", this.isNew()) + .append("lastName", this.getLastName()) + .append("firstName", this.getFirstName()) + .append("address", this.address) + .append("city", this.city) + .append("telephone", this.telephone) + .toString(); } /** @@ -156,7 +160,7 @@ public class Owner extends Person { * @param petId the identifier of the {@link Pet}, must not be {@literal null}. * @param visit the visit to add, must not be {@literal null}. */ - public Owner addVisit(Integer petId, Visit visit) { + public void addVisit(Integer petId, Visit visit) { Assert.notNull(petId, "Pet identifier must not be null!"); Assert.notNull(visit, "Visit must not be null!"); @@ -166,8 +170,6 @@ public class Owner extends Person { Assert.notNull(pet, "Invalid Pet identifier!"); pet.addVisit(visit); - - return this; } } diff --git a/src/main/java/org/springframework/samples/petclinic/owner/OwnerController.java b/src/main/java/org/springframework/samples/petclinic/owner/OwnerController.java index f4fc5d9..fa35064 100644 --- a/src/main/java/org/springframework/samples/petclinic/owner/OwnerController.java +++ b/src/main/java/org/springframework/samples/petclinic/owner/OwnerController.java @@ -16,7 +16,7 @@ package org.springframework.samples.petclinic.owner; import java.util.List; -import java.util.Map; +import java.util.Optional; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; @@ -34,12 +34,14 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import jakarta.validation.Valid; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; /** * @author Juergen Hoeller * @author Ken Krebs * @author Arjen Poutsma * @author Michael Isvy + * @author Wick Dynex */ @Controller class OwnerController { @@ -48,8 +50,8 @@ class OwnerController { private final OwnerRepository owners; - public OwnerController(OwnerRepository clinicService) { - this.owners = clinicService; + public OwnerController(OwnerRepository owners) { + this.owners = owners; } @InitBinder @@ -59,29 +61,31 @@ class OwnerController { @ModelAttribute("owner") public Owner findOwner(@PathVariable(name = "ownerId", required = false) Integer ownerId) { - return ownerId == null ? new Owner() : this.owners.findById(ownerId); + return ownerId == null ? new Owner() + : this.owners.findById(ownerId) + .orElseThrow(() -> new IllegalArgumentException("Owner not found with id: " + ownerId + + ". Please ensure the ID is correct " + "and the owner exists in the database.")); } @GetMapping("/owners/new") - public String initCreationForm(Map model) { - Owner owner = new Owner(); - model.put("owner", owner); + public String initCreationForm() { return VIEWS_OWNER_CREATE_OR_UPDATE_FORM; } @PostMapping("/owners/new") - public String processCreationForm(@Valid Owner owner, BindingResult result) { + public String processCreationForm(@Valid Owner owner, BindingResult result, RedirectAttributes redirectAttributes) { if (result.hasErrors()) { + redirectAttributes.addFlashAttribute("error", "There was an error in creating the owner."); return VIEWS_OWNER_CREATE_OR_UPDATE_FORM; } this.owners.save(owner); + redirectAttributes.addFlashAttribute("message", "New Owner Created"); return "redirect:/owners/" + owner.getId(); } @GetMapping("/owners/find") - public String initFindForm(Map model) { - model.put("owner", new Owner()); + public String initFindForm() { return "owners/findOwners"; } @@ -112,7 +116,6 @@ class OwnerController { } private String addPaginationModel(int page, Model model, Page paginated) { - model.addAttribute("listOwners", paginated); List listOwners = paginated.getContent(); model.addAttribute("currentPage", page); model.addAttribute("totalPages", paginated.getTotalPages()); @@ -124,25 +127,31 @@ class OwnerController { private Page findPaginatedForOwnersLastName(int page, String lastname) { int pageSize = 5; Pageable pageable = PageRequest.of(page - 1, pageSize); - return owners.findByLastName(lastname, pageable); + return owners.findByLastNameStartingWith(lastname, pageable); } @GetMapping("/owners/{ownerId}/edit") - public String initUpdateOwnerForm(@PathVariable("ownerId") int ownerId, Model model) { - Owner owner = this.owners.findById(ownerId); - model.addAttribute(owner); + public String initUpdateOwnerForm() { return VIEWS_OWNER_CREATE_OR_UPDATE_FORM; } @PostMapping("/owners/{ownerId}/edit") - public String processUpdateOwnerForm(@Valid Owner owner, BindingResult result, - @PathVariable("ownerId") int ownerId) { + public String processUpdateOwnerForm(@Valid Owner owner, BindingResult result, @PathVariable("ownerId") int ownerId, + RedirectAttributes redirectAttributes) { if (result.hasErrors()) { + redirectAttributes.addFlashAttribute("error", "There was an error in updating the owner."); return VIEWS_OWNER_CREATE_OR_UPDATE_FORM; } + if (owner.getId() != ownerId) { + result.rejectValue("id", "mismatch", "The owner ID in the form does not match the URL."); + redirectAttributes.addFlashAttribute("error", "Owner ID mismatch. Please try again."); + return "redirect:/owners/{ownerId}/edit"; + } + owner.setId(ownerId); this.owners.save(owner); + redirectAttributes.addFlashAttribute("message", "Owner Values Updated"); return "redirect:/owners/{ownerId}"; } @@ -154,7 +163,9 @@ class OwnerController { @GetMapping("/owners/{ownerId}") public ModelAndView showOwner(@PathVariable("ownerId") int ownerId) { ModelAndView mav = new ModelAndView("owners/ownerDetails"); - Owner owner = this.owners.findById(ownerId); + Optional optionalOwner = this.owners.findById(ownerId); + Owner owner = optionalOwner.orElseThrow(() -> new IllegalArgumentException( + "Owner not found with id: " + ownerId + ". Please ensure the ID is correct ")); mav.addObject(owner); return mav; } diff --git a/src/main/java/org/springframework/samples/petclinic/owner/OwnerRepository.java b/src/main/java/org/springframework/samples/petclinic/owner/OwnerRepository.java index 062df45..5d7a40f 100644 --- a/src/main/java/org/springframework/samples/petclinic/owner/OwnerRepository.java +++ b/src/main/java/org/springframework/samples/petclinic/owner/OwnerRepository.java @@ -16,12 +16,13 @@ package org.springframework.samples.petclinic.owner; import java.util.List; +import java.util.Optional; +import jakarta.annotation.Nonnull; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; +import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.Repository; -import org.springframework.data.repository.query.Param; import org.springframework.transaction.annotation.Transactional; /** @@ -34,15 +35,15 @@ import org.springframework.transaction.annotation.Transactional; * @author Juergen Hoeller * @author Sam Brannen * @author Michael Isvy + * @author Wick Dynex */ -public interface OwnerRepository extends Repository { +public interface OwnerRepository extends JpaRepository { /** * Retrieve all {@link PetType}s from the data store. * @return a Collection of {@link PetType}s. */ @Query("SELECT ptype FROM PetType ptype ORDER BY ptype.name") - @Transactional(readOnly = true) List findPetTypes(); /** @@ -52,31 +53,26 @@ public interface OwnerRepository extends Repository { * @return a Collection of matching {@link Owner}s (or an empty Collection if none * found) */ - - @Query("SELECT DISTINCT owner FROM Owner owner left join owner.pets WHERE owner.lastName LIKE :lastName% ") - @Transactional(readOnly = true) - Page findByLastName(@Param("lastName") String lastName, Pageable pageable); + Page findByLastNameStartingWith(String lastName, Pageable pageable); /** * Retrieve an {@link Owner} from the data store by id. + *

+ * This method returns an {@link Optional} containing the {@link Owner} if found. If + * no {@link Owner} is found with the provided id, it will return an empty + * {@link Optional}. + *

* @param id the id to search for - * @return the {@link Owner} if found + * @return an {@link Optional} containing the {@link Owner} if found, or an empty + * {@link Optional} if not found. + * @throws IllegalArgumentException if the id is null (assuming null is not a valid + * input for id) */ - @Query("SELECT owner FROM Owner owner left join fetch owner.pets WHERE owner.id =:id") - @Transactional(readOnly = true) - Owner findById(@Param("id") Integer id); + Optional findById(@Nonnull Integer id); /** - * Save an {@link Owner} to the data store, either inserting or updating it. - * @param owner the {@link Owner} to save - */ - void save(Owner owner); - - /** - * Returnes all the owners from data store + * Returns all the owners from data store **/ - @Query("SELECT owner FROM Owner owner") - @Transactional(readOnly = true) Page findAll(Pageable pageable); } diff --git a/src/main/java/org/springframework/samples/petclinic/owner/Pet.java b/src/main/java/org/springframework/samples/petclinic/owner/Pet.java old mode 100755 new mode 100644 index 0b0c08a..03fd26c --- a/src/main/java/org/springframework/samples/petclinic/owner/Pet.java +++ b/src/main/java/org/springframework/samples/petclinic/owner/Pet.java @@ -39,6 +39,7 @@ import jakarta.persistence.Table; * @author Ken Krebs * @author Juergen Hoeller * @author Sam Brannen + * @author Wick Dynex */ @Entity @Table(name = "pets") @@ -55,7 +56,7 @@ public class Pet extends NamedEntity { @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) @JoinColumn(name = "pet_id") @OrderBy("visit_date ASC") - private Set visits = new LinkedHashSet<>(); + private final Set visits = new LinkedHashSet<>(); public void setBirthDate(LocalDate birthDate) { this.birthDate = birthDate; diff --git a/src/main/java/org/springframework/samples/petclinic/owner/PetController.java b/src/main/java/org/springframework/samples/petclinic/owner/PetController.java index 9d88f03..fcf431b 100644 --- a/src/main/java/org/springframework/samples/petclinic/owner/PetController.java +++ b/src/main/java/org/springframework/samples/petclinic/owner/PetController.java @@ -15,7 +15,9 @@ */ package org.springframework.samples.petclinic.owner; +import java.time.LocalDate; import java.util.Collection; +import java.util.Optional; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; @@ -30,11 +32,13 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import jakarta.validation.Valid; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; /** * @author Juergen Hoeller * @author Ken Krebs * @author Arjen Poutsma + * @author Wick Dynex */ @Controller @RequestMapping("/owners/{ownerId}") @@ -55,13 +59,24 @@ class PetController { @ModelAttribute("owner") public Owner findOwner(@PathVariable("ownerId") int ownerId) { - return this.owners.findById(ownerId); + Optional optionalOwner = this.owners.findById(ownerId); + Owner owner = optionalOwner.orElseThrow(() -> new IllegalArgumentException( + "Owner not found with id: " + ownerId + ". Please ensure the ID is correct ")); + return owner; } @ModelAttribute("pet") public Pet findPet(@PathVariable("ownerId") int ownerId, @PathVariable(name = "petId", required = false) Integer petId) { - return petId == null ? new Pet() : this.owners.findById(ownerId).getPet(petId); + + if (petId == null) { + return new Pet(); + } + + Optional optionalOwner = this.owners.findById(ownerId); + Owner owner = optionalOwner.orElseThrow(() -> new IllegalArgumentException( + "Owner not found with id: " + ownerId + ". Please ensure the ID is correct ")); + return owner.getPet(petId); } @InitBinder("owner") @@ -78,42 +93,62 @@ class PetController { public String initCreationForm(Owner owner, ModelMap model) { Pet pet = new Pet(); owner.addPet(pet); - model.put("pet", pet); return VIEWS_PETS_CREATE_OR_UPDATE_FORM; } @PostMapping("/pets/new") - public String processCreationForm(Owner owner, @Valid Pet pet, BindingResult result, ModelMap model) { - if (StringUtils.hasLength(pet.getName()) && pet.isNew() && owner.getPet(pet.getName(), true) != null) { + public String processCreationForm(Owner owner, @Valid Pet pet, BindingResult result, + RedirectAttributes redirectAttributes) { + + if (StringUtils.hasText(pet.getName()) && pet.isNew() && owner.getPet(pet.getName(), true) != null) result.rejectValue("name", "duplicate", "already exists"); + + LocalDate currentDate = LocalDate.now(); + if (pet.getBirthDate() != null && pet.getBirthDate().isAfter(currentDate)) { + result.rejectValue("birthDate", "typeMismatch.birthDate"); } - owner.addPet(pet); if (result.hasErrors()) { - model.put("pet", pet); return VIEWS_PETS_CREATE_OR_UPDATE_FORM; } + owner.addPet(pet); this.owners.save(owner); + redirectAttributes.addFlashAttribute("message", "New Pet has been Added"); return "redirect:/owners/{ownerId}"; } @GetMapping("/pets/{petId}/edit") - public String initUpdateForm(Owner owner, @PathVariable("petId") int petId, ModelMap model) { - Pet pet = owner.getPet(petId); - model.put("pet", pet); + public String initUpdateForm() { return VIEWS_PETS_CREATE_OR_UPDATE_FORM; } @PostMapping("/pets/{petId}/edit") - public String processUpdateForm(@Valid Pet pet, BindingResult result, Owner owner, ModelMap model) { + public String processUpdateForm(Owner owner, @Valid Pet pet, BindingResult result, + RedirectAttributes redirectAttributes) { + + String petName = pet.getName(); + + // checking if the pet name already exist for the owner + if (StringUtils.hasText(petName)) { + Pet existingPet = owner.getPet(petName, false); + if (existingPet != null && !existingPet.getId().equals(pet.getId())) { + result.rejectValue("name", "duplicate", "already exists"); + } + } + + LocalDate currentDate = LocalDate.now(); + if (pet.getBirthDate() != null && pet.getBirthDate().isAfter(currentDate)) { + result.rejectValue("birthDate", "typeMismatch.birthDate"); + } + if (result.hasErrors()) { - model.put("pet", pet); return VIEWS_PETS_CREATE_OR_UPDATE_FORM; } owner.addPet(pet); this.owners.save(owner); + redirectAttributes.addFlashAttribute("message", "Pet details has been edited"); return "redirect:/owners/{ownerId}"; } diff --git a/src/main/java/org/springframework/samples/petclinic/owner/PetValidator.java b/src/main/java/org/springframework/samples/petclinic/owner/PetValidator.java index e1370b4..6422aa8 100644 --- a/src/main/java/org/springframework/samples/petclinic/owner/PetValidator.java +++ b/src/main/java/org/springframework/samples/petclinic/owner/PetValidator.java @@ -38,7 +38,7 @@ public class PetValidator implements Validator { Pet pet = (Pet) obj; String name = pet.getName(); // name validation - if (!StringUtils.hasLength(name)) { + if (!StringUtils.hasText(name)) { errors.rejectValue("name", REQUIRED, REQUIRED); } diff --git a/src/main/java/org/springframework/samples/petclinic/owner/Visit.java b/src/main/java/org/springframework/samples/petclinic/owner/Visit.java old mode 100755 new mode 100644 index d052a4e..35569bd --- a/src/main/java/org/springframework/samples/petclinic/owner/Visit.java +++ b/src/main/java/org/springframework/samples/petclinic/owner/Visit.java @@ -23,7 +23,7 @@ import org.springframework.samples.petclinic.model.BaseEntity; import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.Table; -import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotBlank; /** * Simple JavaBean domain object representing a visit. @@ -39,7 +39,7 @@ public class Visit extends BaseEntity { @DateTimeFormat(pattern = "yyyy-MM-dd") private LocalDate date; - @NotEmpty + @NotBlank private String description; /** diff --git a/src/main/java/org/springframework/samples/petclinic/owner/VisitController.java b/src/main/java/org/springframework/samples/petclinic/owner/VisitController.java index c823d91..b546f60 100644 --- a/src/main/java/org/springframework/samples/petclinic/owner/VisitController.java +++ b/src/main/java/org/springframework/samples/petclinic/owner/VisitController.java @@ -16,6 +16,7 @@ package org.springframework.samples.petclinic.owner; import java.util.Map; +import java.util.Optional; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; @@ -27,6 +28,7 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import jakarta.validation.Valid; +import org.springframework.web.servlet.mvc.support.RedirectAttributes; /** * @author Juergen Hoeller @@ -34,6 +36,7 @@ import jakarta.validation.Valid; * @author Arjen Poutsma * @author Michael Isvy * @author Dave Syer + * @author Wick Dynex */ @Controller class VisitController { @@ -59,7 +62,9 @@ class VisitController { @ModelAttribute("visit") public Visit loadPetWithVisit(@PathVariable("ownerId") int ownerId, @PathVariable("petId") int petId, Map model) { - Owner owner = this.owners.findById(ownerId); + Optional optionalOwner = owners.findById(ownerId); + Owner owner = optionalOwner.orElseThrow(() -> new IllegalArgumentException( + "Owner not found with id: " + ownerId + ". Please ensure the ID is correct ")); Pet pet = owner.getPet(petId); model.put("pet", pet); @@ -81,13 +86,14 @@ class VisitController { // called @PostMapping("/owners/{ownerId}/pets/{petId}/visits/new") public String processNewVisitForm(@ModelAttribute Owner owner, @PathVariable int petId, @Valid Visit visit, - BindingResult result) { + BindingResult result, RedirectAttributes redirectAttributes) { if (result.hasErrors()) { return "pets/createOrUpdateVisitForm"; } owner.addVisit(petId, visit); this.owners.save(owner); + redirectAttributes.addFlashAttribute("message", "Your visit has been booked"); return "redirect:/owners/{ownerId}"; } diff --git a/src/main/java/org/springframework/samples/petclinic/system/CacheConfiguration.java b/src/main/java/org/springframework/samples/petclinic/system/CacheConfiguration.java old mode 100755 new mode 100644 diff --git a/src/main/java/org/springframework/samples/petclinic/vet/Vet.java b/src/main/java/org/springframework/samples/petclinic/vet/Vet.java index 7a70155..d8a1fc8 100644 --- a/src/main/java/org/springframework/samples/petclinic/vet/Vet.java +++ b/src/main/java/org/springframework/samples/petclinic/vet/Vet.java @@ -57,10 +57,6 @@ public class Vet extends Person { return this.specialties; } - protected void setSpecialtiesInternal(Set specialties) { - this.specialties = specialties; - } - @XmlElement public List getSpecialties() { List sortedSpecs = new ArrayList<>(getSpecialtiesInternal()); diff --git a/src/main/java/org/springframework/samples/petclinic/vet/VetController.java b/src/main/java/org/springframework/samples/petclinic/vet/VetController.java index 69c3be9..29fcecc 100644 --- a/src/main/java/org/springframework/samples/petclinic/vet/VetController.java +++ b/src/main/java/org/springframework/samples/petclinic/vet/VetController.java @@ -37,8 +37,8 @@ class VetController { private final VetRepository vetRepository; - public VetController(VetRepository clinicService) { - this.vetRepository = clinicService; + public VetController(VetRepository vetRepository) { + this.vetRepository = vetRepository; } @GetMapping("/vets.html") @@ -49,7 +49,6 @@ class VetController { Page paginated = findPaginated(page); vets.getVetList().addAll(paginated.toList()); return addPaginationModel(page, paginated, model); - } private String addPaginationModel(int page, Page paginated, Model model) { diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 5d3eeed..6ed9856 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -8,7 +8,7 @@ spring.thymeleaf.mode=HTML # JPA spring.jpa.hibernate.ddl-auto=none -spring.jpa.open-in-view=true +spring.jpa.open-in-view=false # Internationalization spring.messages.basename=messages/messages diff --git a/src/main/resources/db/postgres/data.sql b/src/main/resources/db/postgres/data.sql index 96c9d46..5b53366 100644 --- a/src/main/resources/db/postgres/data.sql +++ b/src/main/resources/db/postgres/data.sql @@ -15,12 +15,12 @@ INSERT INTO vet_specialties VALUES (3, 3) ON CONFLICT (vet_id, specialty_id) DO INSERT INTO vet_specialties VALUES (4, 2) ON CONFLICT (vet_id, specialty_id) DO NOTHING; INSERT INTO vet_specialties VALUES (5, 1) ON CONFLICT (vet_id, specialty_id) DO NOTHING; -INSERT INTO types (name) SELECT 'cat' WHERE NOT EXISTS (SELECT * FROM specialties WHERE name='cat'); -INSERT INTO types (name) SELECT 'dog' WHERE NOT EXISTS (SELECT * FROM specialties WHERE name='dog'); -INSERT INTO types (name) SELECT 'lizard' WHERE NOT EXISTS (SELECT * FROM specialties WHERE name='lizard'); -INSERT INTO types (name) SELECT 'snake' WHERE NOT EXISTS (SELECT * FROM specialties WHERE name='snake'); -INSERT INTO types (name) SELECT 'bird' WHERE NOT EXISTS (SELECT * FROM specialties WHERE name='bird'); -INSERT INTO types (name) SELECT 'hamster' WHERE NOT EXISTS (SELECT * FROM specialties WHERE name='cat'); +INSERT INTO types (name) SELECT 'cat' WHERE NOT EXISTS (SELECT * FROM types WHERE name='cat'); +INSERT INTO types (name) SELECT 'dog' WHERE NOT EXISTS (SELECT * FROM types WHERE name='dog'); +INSERT INTO types (name) SELECT 'lizard' WHERE NOT EXISTS (SELECT * FROM types WHERE name='lizard'); +INSERT INTO types (name) SELECT 'snake' WHERE NOT EXISTS (SELECT * FROM types WHERE name='snake'); +INSERT INTO types (name) SELECT 'bird' WHERE NOT EXISTS (SELECT * FROM types WHERE name='bird'); +INSERT INTO types (name) SELECT 'hamster' WHERE NOT EXISTS (SELECT * FROM types WHERE name='hamster'); INSERT INTO owners (first_name, last_name, address, city, telephone) SELECT 'George', 'Franklin', '110 W. Liberty St.', 'Madison', '6085551023' WHERE NOT EXISTS (SELECT * FROM owners WHERE id=1); INSERT INTO owners (first_name, last_name, address, city, telephone) SELECT 'Betty', 'Davis', '638 Cardinal Ave.', 'Sun Prairie', '6085551749' WHERE NOT EXISTS (SELECT * FROM owners WHERE id=2); diff --git a/src/main/resources/messages/messages_de.properties b/src/main/resources/messages/messages_de.properties index 124bee4..4828d85 100644 --- a/src/main/resources/messages/messages_de.properties +++ b/src/main/resources/messages/messages_de.properties @@ -4,5 +4,6 @@ notFound=wurde nicht gefunden duplicate=ist bereits vergeben nonNumeric=darf nur numerisch sein duplicateFormSubmission=Wiederholtes Absenden des Formulars ist nicht erlaubt -typeMismatch.date=ungltiges Datum -typeMismatch.birthDate=ungltiges Datum +typeMismatch.date=ung�ltiges Datum +typeMismatch.birthDate=ung�ltiges Datum + diff --git a/src/main/resources/messages/messages_es.properties b/src/main/resources/messages/messages_es.properties index 33ee867..116016f 100644 --- a/src/main/resources/messages/messages_es.properties +++ b/src/main/resources/messages/messages_es.properties @@ -6,3 +6,4 @@ nonNumeric=Sólo debe contener numeros duplicateFormSubmission=No se permite el envío de formularios duplicados typeMismatch.date=Fecha invalida typeMismatch.birthDate=Fecha invalida + diff --git a/src/main/resources/messages/messages_fa.properties b/src/main/resources/messages/messages_fa.properties new file mode 100644 index 0000000..a68a21c --- /dev/null +++ b/src/main/resources/messages/messages_fa.properties @@ -0,0 +1,9 @@ +welcome=خوش آمدید +required=الزامی +notFound=یافت نشد +duplicate=قبلا استفاده شده +nonNumeric=باید عددی باشد +duplicateFormSubmission=ارسال تکراری فرم مجاز نیست +typeMismatch.date=تاریخ نامعتبر +typeMismatch.birthDate=تاریخ تولد نامعتبر + diff --git a/src/main/resources/messages/messages_ko.properties b/src/main/resources/messages/messages_ko.properties new file mode 100644 index 0000000..6cd27bf --- /dev/null +++ b/src/main/resources/messages/messages_ko.properties @@ -0,0 +1,8 @@ +welcome=환영합니다 +required=입력이 필요합니다 +notFound=찾을 수 없습니다 +duplicate=이미 존재합니다 +nonNumeric=모두 숫자로 입력해야 합니다 +duplicateFormSubmission=중복 제출은 허용되지 않습니다 +typeMismatch.date=잘못된 날짜입니다 +typeMismatch.birthDate=잘못된 날짜입니다 diff --git a/src/main/resources/messages/messages_pt.properties b/src/main/resources/messages/messages_pt.properties new file mode 100644 index 0000000..e9bc35a --- /dev/null +++ b/src/main/resources/messages/messages_pt.properties @@ -0,0 +1,8 @@ +welcome=Bem-vindo +required=E necessario +notFound=Nao foi encontrado +duplicate=Ja esta em uso +nonNumeric=Deve ser tudo numerico +duplicateFormSubmission=O envio duplicado de formulario nao e permitido +typeMismatch.date=Data invalida +typeMismatch.birthDate=Data de nascimento invalida diff --git a/src/main/resources/messages/messages_ru.properties b/src/main/resources/messages/messages_ru.properties new file mode 100644 index 0000000..7e8d54d --- /dev/null +++ b/src/main/resources/messages/messages_ru.properties @@ -0,0 +1,9 @@ +welcome=Добро пожаловать +required=необходимо +notFound=не найдено +duplicate=уже используется +nonNumeric=должно быть все числовое значение +duplicateFormSubmission=Дублирование формы не допускается +typeMismatch.date=неправильная даные +typeMismatch.birthDate=неправильная дата + diff --git a/src/main/resources/messages/messages_tr.properties b/src/main/resources/messages/messages_tr.properties new file mode 100644 index 0000000..1020566 --- /dev/null +++ b/src/main/resources/messages/messages_tr.properties @@ -0,0 +1,9 @@ +welcome=hoş geldiniz +required=gerekli +notFound=bulunamadı +duplicate=zaten kullanılıyor +nonNumeric=sadece sayısal olmalıdır +duplicateFormSubmission=Formun tekrar gönderilmesine izin verilmez +typeMismatch.date=geçersiz tarih +typeMismatch.birthDate=geçersiz tarih + diff --git a/src/main/resources/static/resources/css/petclinic.css b/src/main/resources/static/resources/css/petclinic.css index 38b04a3..bbf3f0d 100644 --- a/src/main/resources/static/resources/css/petclinic.css +++ b/src/main/resources/static/resources/css/petclinic.css @@ -12,12 +12,12 @@ * limitations under the License. */ /*! - * Bootstrap v5.1.3 (https://getbootstrap.com/) - * Copyright 2011-2021 The Bootstrap Authors - * Copyright 2011-2021 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) - */ -:root { + * Bootstrap v5.3.3 (https://getbootstrap.com/) + * Copyright 2011-2024 The Bootstrap Authors + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + */ +:root, +[data-bs-theme="light"] { --bs-blue: #0d6efd; --bs-indigo: #6610f2; --bs-purple: #6f42c1; @@ -28,6 +28,7 @@ --bs-green: #198754; --bs-teal: #20c997; --bs-cyan: #0dcaf0; + --bs-black: #000; --bs-white: #fff; --bs-gray: #6c757d; --bs-gray-dark: #343a40; @@ -56,11 +57,33 @@ --bs-danger-rgb: 220, 53, 69; --bs-light-rgb: 248, 249, 250; --bs-dark-rgb: 33, 37, 41; + --bs-primary-text-emphasis: #052c65; + --bs-secondary-text-emphasis: #2b2f32; + --bs-success-text-emphasis: #0a3622; + --bs-info-text-emphasis: #055160; + --bs-warning-text-emphasis: #664d03; + --bs-danger-text-emphasis: #58151c; + --bs-light-text-emphasis: #495057; + --bs-dark-text-emphasis: #495057; + --bs-primary-bg-subtle: #cfe2ff; + --bs-secondary-bg-subtle: #e2e3e5; + --bs-success-bg-subtle: #d1e7dd; + --bs-info-bg-subtle: #cff4fc; + --bs-warning-bg-subtle: #fff3cd; + --bs-danger-bg-subtle: #f8d7da; + --bs-light-bg-subtle: #fcfcfd; + --bs-dark-bg-subtle: #ced4da; + --bs-primary-border-subtle: #9ec5fe; + --bs-secondary-border-subtle: #c4c8cb; + --bs-success-border-subtle: #a3cfbb; + --bs-info-border-subtle: #9eeaf9; + --bs-warning-border-subtle: #ffe69c; + --bs-danger-border-subtle: #f1aeb5; + --bs-light-border-subtle: #e9ecef; + --bs-dark-border-subtle: #adb5bd; --bs-white-rgb: 255, 255, 255; --bs-black-rgb: 0, 0, 0; - --bs-body-color-rgb: 33, 37, 41; - --bs-body-bg-rgb: 255, 255, 255; - --bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; + --bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; --bs-font-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; --bs-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0)); --bs-body-font-family: var(--bs-font-sans-serif); @@ -68,7 +91,105 @@ --bs-body-font-weight: 400; --bs-body-line-height: 1.5; --bs-body-color: #212529; - --bs-body-bg: #fff; } + --bs-body-color-rgb: 33, 37, 41; + --bs-body-bg: #fff; + --bs-body-bg-rgb: 255, 255, 255; + --bs-emphasis-color: #000; + --bs-emphasis-color-rgb: 0, 0, 0; + --bs-secondary-color: rgba(33, 37, 41, 0.75); + --bs-secondary-color-rgb: 33, 37, 41; + --bs-secondary-bg: #e9ecef; + --bs-secondary-bg-rgb: 233, 236, 239; + --bs-tertiary-color: rgba(33, 37, 41, 0.5); + --bs-tertiary-color-rgb: 33, 37, 41; + --bs-tertiary-bg: #f8f9fa; + --bs-tertiary-bg-rgb: 248, 249, 250; + --bs-heading-color: inherit; + --bs-link-color: #0d6efd; + --bs-link-color-rgb: 13, 110, 253; + --bs-link-decoration: underline; + --bs-link-hover-color: #0a58ca; + --bs-link-hover-color-rgb: 10, 88, 202; + --bs-code-color: #d63384; + --bs-highlight-color: #212529; + --bs-highlight-bg: #fff3cd; + --bs-border-width: 1px; + --bs-border-style: solid; + --bs-border-color: #dee2e6; + --bs-border-color-translucent: rgba(0, 0, 0, 0.175); + --bs-border-radius: 0.375rem; + --bs-border-radius-sm: 0.25rem; + --bs-border-radius-lg: 0.5rem; + --bs-border-radius-xl: 1rem; + --bs-border-radius-xxl: 2rem; + --bs-border-radius-2xl: var(--bs-border-radius-xxl); + --bs-border-radius-pill: 50rem; + --bs-box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15); + --bs-box-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075); + --bs-box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175); + --bs-box-shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.075); + --bs-focus-ring-width: 0.25rem; + --bs-focus-ring-opacity: 0.25; + --bs-focus-ring-color: rgba(13, 110, 253, 0.25); + --bs-form-valid-color: #198754; + --bs-form-valid-border-color: #198754; + --bs-form-invalid-color: #dc3545; + --bs-form-invalid-border-color: #dc3545; } + +[data-bs-theme="dark"] { + color-scheme: dark; + --bs-body-color: #dee2e6; + --bs-body-color-rgb: 222, 226, 230; + --bs-body-bg: #212529; + --bs-body-bg-rgb: 33, 37, 41; + --bs-emphasis-color: #fff; + --bs-emphasis-color-rgb: 255, 255, 255; + --bs-secondary-color: rgba(222, 226, 230, 0.75); + --bs-secondary-color-rgb: 222, 226, 230; + --bs-secondary-bg: #343a40; + --bs-secondary-bg-rgb: 52, 58, 64; + --bs-tertiary-color: rgba(222, 226, 230, 0.5); + --bs-tertiary-color-rgb: 222, 226, 230; + --bs-tertiary-bg: #2b3035; + --bs-tertiary-bg-rgb: 43, 48, 53; + --bs-primary-text-emphasis: #6ea8fe; + --bs-secondary-text-emphasis: #a7acb1; + --bs-success-text-emphasis: #75b798; + --bs-info-text-emphasis: #6edff6; + --bs-warning-text-emphasis: #ffda6a; + --bs-danger-text-emphasis: #ea868f; + --bs-light-text-emphasis: #f8f9fa; + --bs-dark-text-emphasis: #dee2e6; + --bs-primary-bg-subtle: #031633; + --bs-secondary-bg-subtle: #161719; + --bs-success-bg-subtle: #051b11; + --bs-info-bg-subtle: #032830; + --bs-warning-bg-subtle: #332701; + --bs-danger-bg-subtle: #2c0b0e; + --bs-light-bg-subtle: #343a40; + --bs-dark-bg-subtle: #1a1d20; + --bs-primary-border-subtle: #084298; + --bs-secondary-border-subtle: #41464b; + --bs-success-border-subtle: #0f5132; + --bs-info-border-subtle: #087990; + --bs-warning-border-subtle: #997404; + --bs-danger-border-subtle: #842029; + --bs-light-border-subtle: #495057; + --bs-dark-border-subtle: #343a40; + --bs-heading-color: inherit; + --bs-link-color: #6ea8fe; + --bs-link-hover-color: #8bb9fe; + --bs-link-color-rgb: 110, 168, 254; + --bs-link-hover-color-rgb: 139, 185, 254; + --bs-code-color: #e685b5; + --bs-highlight-color: #dee2e6; + --bs-highlight-bg: #664d03; + --bs-border-color: #495057; + --bs-border-color-translucent: rgba(255, 255, 255, 0.15); + --bs-form-valid-color: #75b798; + --bs-form-valid-border-color: #75b798; + --bs-form-invalid-color: #ea868f; + --bs-form-invalid-border-color: #ea868f; } *, *::before, @@ -94,18 +215,16 @@ body { hr { margin: 1rem 0; color: inherit; - background-color: currentColor; border: 0; + border-top: var(--bs-border-width) solid; opacity: 0.25; } -hr:not([size]) { - height: 1px; } - h6, .h6, h5, .h5, h4, .h4, h3, .h3, h2, .h2, h1, .h1 { margin-top: 0; margin-bottom: 0.5rem; font-weight: 500; - line-height: 1.2; } + line-height: 1.2; + color: var(--bs-heading-color); } h1, .h1 { font-size: calc(1.375rem + 1.5vw); } @@ -137,8 +256,7 @@ p { margin-top: 0; margin-bottom: 1rem; } -abbr[title], -abbr[data-bs-original-title] { +abbr[title] { text-decoration: underline dotted; cursor: help; text-decoration-skip-ink: none; } @@ -182,8 +300,9 @@ small, .small { font-size: 0.875em; } mark, .mark { - padding: 0.2em; - background-color: #fcf8e3; } + padding: 0.1875em; + color: var(--bs-highlight-color); + background-color: var(--bs-highlight-bg); } sub, sup { @@ -199,10 +318,10 @@ sup { top: -.5em; } a { - color: #0d6efd; + color: rgba(var(--bs-link-color-rgb), var(--bs-link-opacity, 1)); text-decoration: underline; } a:hover { - color: #0a58ca; } + --bs-link-color-rgb: var(--bs-link-hover-color-rgb); } a:not([href]):not([class]), a:not([href]):not([class]):hover { color: inherit; @@ -213,9 +332,7 @@ code, kbd, samp { font-family: var(--bs-font-monospace); - font-size: 1em; - direction: ltr /* rtl:ignore */; - unicode-bidi: bidi-override; } + font-size: 1em; } pre { display: block; @@ -230,21 +347,20 @@ pre { code { font-size: 0.875em; - color: #d63384; + color: var(--bs-code-color); word-wrap: break-word; } a > code { color: inherit; } kbd { - padding: 0.2rem 0.4rem; + padding: 0.1875rem 0.375rem; font-size: 0.875em; - color: #fff; - background-color: #212529; - border-radius: 0.2rem; } + color: var(--bs-body-bg); + background-color: var(--bs-body-color); + border-radius: 0.25rem; } kbd kbd { padding: 0; - font-size: 1em; - font-weight: 700; } + font-size: 1em; } figure { margin: 0 0 1rem; } @@ -260,7 +376,7 @@ table { caption { padding-top: 0.5rem; padding-bottom: 0.5rem; - color: #6c757d; + color: var(--bs-secondary-color); text-align: left; } th { @@ -308,8 +424,8 @@ select { select:disabled { opacity: 1; } -[list]::-webkit-calendar-picker-indicator { - display: none; } +[list]:not([type="date"]):not([type="datetime-local"]):not([type="month"]):not([type="week"]):not([type="time"])::-webkit-calendar-picker-indicator { + display: none !important; } button, [type="button"], @@ -361,8 +477,8 @@ legend { height: auto; } [type="search"] { - outline-offset: -2px; - -webkit-appearance: textfield; } + -webkit-appearance: textfield; + outline-offset: -2px; } /* rtl:raw: [type="tel"], @@ -379,9 +495,6 @@ legend { padding: 0; } ::file-selector-button { - font: inherit; } - -::-webkit-file-upload-button { font: inherit; -webkit-appearance: button; } @@ -484,9 +597,9 @@ progress { .img-thumbnail { padding: 0.25rem; - background-color: #fff; - border: 1px solid #dee2e6; - border-radius: 0.25rem; + background-color: var(--bs-body-bg); + border: var(--bs-border-width) solid var(--bs-border-color); + border-radius: var(--bs-border-radius); max-width: 100%; height: auto; } @@ -499,7 +612,7 @@ progress { .figure-caption { font-size: 0.875em; - color: #6c757d; } + color: var(--bs-secondary-color); } .container, .container-fluid, @@ -508,9 +621,11 @@ progress { .container-lg, .container-md, .container-sm { + --bs-gutter-x: 1.5rem; + --bs-gutter-y: 0; width: 100%; - padding-right: var(--bs-gutter-x, 0.75rem); - padding-left: var(--bs-gutter-x, 0.75rem); + padding-right: calc(var(--bs-gutter-x) * .5); + padding-left: calc(var(--bs-gutter-x) * .5); margin-right: auto; margin-left: auto; } @@ -534,6 +649,14 @@ progress { .container-xxl, .container-xl, .container-lg, .container-md, .container-sm, .container { max-width: 1320px; } } +:root { + --bs-breakpoint-xs: 0; + --bs-breakpoint-sm: 576px; + --bs-breakpoint-md: 768px; + --bs-breakpoint-lg: 992px; + --bs-breakpoint-xl: 1200px; + --bs-breakpoint-xxl: 1400px; } + .row { --bs-gutter-x: 1.5rem; --bs-gutter-y: 0; @@ -1335,30 +1458,37 @@ progress { --bs-gutter-y: 3rem; } } .table { - --bs-table-bg: transparent; + --bs-table-color-type: initial; + --bs-table-bg-type: initial; + --bs-table-color-state: initial; + --bs-table-bg-state: initial; + --bs-table-color: var(--bs-emphasis-color); + --bs-table-bg: var(--bs-body-bg); + --bs-table-border-color: var(--bs-border-color); --bs-table-accent-bg: transparent; - --bs-table-striped-color: #212529; - --bs-table-striped-bg: rgba(0, 0, 0, 0.05); - --bs-table-active-color: #212529; - --bs-table-active-bg: rgba(0, 0, 0, 0.1); - --bs-table-hover-color: #212529; - --bs-table-hover-bg: rgba(0, 0, 0, 0.075); + --bs-table-striped-color: var(--bs-emphasis-color); + --bs-table-striped-bg: rgba(var(--bs-emphasis-color-rgb), 0.05); + --bs-table-active-color: var(--bs-emphasis-color); + --bs-table-active-bg: rgba(var(--bs-emphasis-color-rgb), 0.1); + --bs-table-hover-color: var(--bs-emphasis-color); + --bs-table-hover-bg: rgba(var(--bs-emphasis-color-rgb), 0.075); width: 100%; margin-bottom: 1rem; - color: #212529; vertical-align: top; - border-color: #dee2e6; } + border-color: var(--bs-table-border-color); } .table > :not(caption) > * > * { padding: 0.5rem 0.5rem; + color: var(--bs-table-color-state, var(--bs-table-color-type, var(--bs-table-color))); background-color: var(--bs-table-bg); - border-bottom-width: 1px; - box-shadow: inset 0 0 0 9999px var(--bs-table-accent-bg); } + border-bottom-width: var(--bs-border-width); + box-shadow: inset 0 0 0 9999px var(--bs-table-bg-state, var(--bs-table-bg-type, var(--bs-table-accent-bg))); } .table > tbody { vertical-align: inherit; } .table > thead { vertical-align: bottom; } - .table > :not(:first-child) { - border-top: 2px solid currentColor; } + +.table-group-divider { + border-top: calc(var(--bs-border-width) * 2) solid currentcolor; } .caption-top { caption-side: top; } @@ -1367,9 +1497,9 @@ progress { padding: 0.25rem 0.25rem; } .table-bordered > :not(caption) > * { - border-width: 1px 0; } + border-width: var(--bs-border-width) 0; } .table-bordered > :not(caption) > * > * { - border-width: 0 1px; } + border-width: 0 var(--bs-border-width); } .table-borderless > :not(caption) > * > * { border-bottom-width: 0; } @@ -1378,104 +1508,124 @@ progress { border-top-width: 0; } .table-striped > tbody > tr:nth-of-type(odd) > * { - --bs-table-accent-bg: var(--bs-table-striped-bg); - color: var(--bs-table-striped-color); } + --bs-table-color-type: var(--bs-table-striped-color); + --bs-table-bg-type: var(--bs-table-striped-bg); } + +.table-striped-columns > :not(caption) > tr > :nth-child(even) { + --bs-table-color-type: var(--bs-table-striped-color); + --bs-table-bg-type: var(--bs-table-striped-bg); } .table-active { - --bs-table-accent-bg: var(--bs-table-active-bg); - color: var(--bs-table-active-color); } + --bs-table-color-state: var(--bs-table-active-color); + --bs-table-bg-state: var(--bs-table-active-bg); } .table-hover > tbody > tr:hover > * { - --bs-table-accent-bg: var(--bs-table-hover-bg); - color: var(--bs-table-hover-color); } + --bs-table-color-state: var(--bs-table-hover-color); + --bs-table-bg-state: var(--bs-table-hover-bg); } .table-primary { + --bs-table-color: #000; --bs-table-bg: #cfe2ff; + --bs-table-border-color: #a6b5cc; --bs-table-striped-bg: #c5d7f2; --bs-table-striped-color: #000; --bs-table-active-bg: #bacbe6; --bs-table-active-color: #000; --bs-table-hover-bg: #bfd1ec; --bs-table-hover-color: #000; - color: #000; - border-color: #bacbe6; } + color: var(--bs-table-color); + border-color: var(--bs-table-border-color); } .table-secondary { + --bs-table-color: #000; --bs-table-bg: #e2e3e5; + --bs-table-border-color: #b5b6b7; --bs-table-striped-bg: #d7d8da; --bs-table-striped-color: #000; --bs-table-active-bg: #cbccce; --bs-table-active-color: #000; --bs-table-hover-bg: #d1d2d4; --bs-table-hover-color: #000; - color: #000; - border-color: #cbccce; } + color: var(--bs-table-color); + border-color: var(--bs-table-border-color); } .table-success { + --bs-table-color: #000; --bs-table-bg: #d1e7dd; + --bs-table-border-color: #a7b9b1; --bs-table-striped-bg: #c7dbd2; --bs-table-striped-color: #000; --bs-table-active-bg: #bcd0c7; --bs-table-active-color: #000; --bs-table-hover-bg: #c1d6cc; --bs-table-hover-color: #000; - color: #000; - border-color: #bcd0c7; } + color: var(--bs-table-color); + border-color: var(--bs-table-border-color); } .table-info { + --bs-table-color: #000; --bs-table-bg: #cff4fc; + --bs-table-border-color: #a6c3ca; --bs-table-striped-bg: #c5e8ef; --bs-table-striped-color: #000; --bs-table-active-bg: #badce3; --bs-table-active-color: #000; --bs-table-hover-bg: #bfe2e9; --bs-table-hover-color: #000; - color: #000; - border-color: #badce3; } + color: var(--bs-table-color); + border-color: var(--bs-table-border-color); } .table-warning { + --bs-table-color: #000; --bs-table-bg: #fff3cd; + --bs-table-border-color: #ccc2a4; --bs-table-striped-bg: #f2e7c3; --bs-table-striped-color: #000; --bs-table-active-bg: #e6dbb9; --bs-table-active-color: #000; --bs-table-hover-bg: #ece1be; --bs-table-hover-color: #000; - color: #000; - border-color: #e6dbb9; } + color: var(--bs-table-color); + border-color: var(--bs-table-border-color); } .table-danger { + --bs-table-color: #000; --bs-table-bg: #f8d7da; + --bs-table-border-color: #c6acae; --bs-table-striped-bg: #eccccf; --bs-table-striped-color: #000; --bs-table-active-bg: #dfc2c4; --bs-table-active-color: #000; --bs-table-hover-bg: #e5c7ca; --bs-table-hover-color: #000; - color: #000; - border-color: #dfc2c4; } + color: var(--bs-table-color); + border-color: var(--bs-table-border-color); } .table-light { + --bs-table-color: #000; --bs-table-bg: #f8f9fa; + --bs-table-border-color: #c6c7c8; --bs-table-striped-bg: #ecedee; --bs-table-striped-color: #000; --bs-table-active-bg: #dfe0e1; --bs-table-active-color: #000; --bs-table-hover-bg: #e5e6e7; --bs-table-hover-color: #000; - color: #000; - border-color: #dfe0e1; } + color: var(--bs-table-color); + border-color: var(--bs-table-border-color); } .table-dark { + --bs-table-color: #fff; --bs-table-bg: #212529; + --bs-table-border-color: #4d5154; --bs-table-striped-bg: #2c3034; --bs-table-striped-color: #fff; --bs-table-active-bg: #373b3e; --bs-table-active-color: #fff; --bs-table-hover-bg: #323539; --bs-table-hover-color: #fff; - color: #fff; - border-color: #373b3e; } + color: var(--bs-table-color); + border-color: var(--bs-table-border-color); } .table-responsive { overflow-x: auto; @@ -1510,26 +1660,26 @@ progress { margin-bottom: 0.5rem; } .col-form-label { - padding-top: calc(0.375rem + 1px); - padding-bottom: calc(0.375rem + 1px); + padding-top: calc(0.375rem + var(--bs-border-width)); + padding-bottom: calc(0.375rem + var(--bs-border-width)); margin-bottom: 0; font-size: inherit; line-height: 1.5; } .col-form-label-lg { - padding-top: calc(0.5rem + 1px); - padding-bottom: calc(0.5rem + 1px); + padding-top: calc(0.5rem + var(--bs-border-width)); + padding-bottom: calc(0.5rem + var(--bs-border-width)); font-size: 1.25rem; } .col-form-label-sm { - padding-top: calc(0.25rem + 1px); - padding-bottom: calc(0.25rem + 1px); + padding-top: calc(0.25rem + var(--bs-border-width)); + padding-bottom: calc(0.25rem + var(--bs-border-width)); font-size: 0.875rem; } .form-text { margin-top: 0.25rem; font-size: 0.875em; - color: #6c757d; } + color: var(--bs-secondary-color); } .form-control { display: block; @@ -1538,12 +1688,12 @@ progress { font-size: 1rem; font-weight: 400; line-height: 1.5; - color: #212529; - background-color: #fff; - background-clip: padding-box; - border: 1px solid #ced4da; + color: var(--bs-body-color); appearance: none; - border-radius: 0.25rem; + background-color: var(--bs-body-bg); + background-clip: padding-box; + border: var(--bs-border-width) solid var(--bs-border-color); + border-radius: var(--bs-border-radius); transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; } @media (prefers-reduced-motion: reduce) { .form-control { @@ -1553,55 +1703,42 @@ progress { .form-control[type="file"]:not(:disabled):not([readonly]) { cursor: pointer; } .form-control:focus { - color: #212529; - background-color: #fff; + color: var(--bs-body-color); + background-color: var(--bs-body-bg); border-color: #86b7fe; outline: 0; box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25); } .form-control::-webkit-date-and-time-value { - height: 1.5em; } + min-width: 85px; + height: 1.5em; + margin: 0; } + .form-control::-webkit-datetime-edit { + display: block; + padding: 0; } .form-control::placeholder { - color: #6c757d; + color: var(--bs-secondary-color); opacity: 1; } - .form-control:disabled, .form-control[readonly] { - background-color: #e9ecef; + .form-control:disabled { + background-color: var(--bs-secondary-bg); opacity: 1; } .form-control::file-selector-button { padding: 0.375rem 0.75rem; margin: -0.375rem -0.75rem; margin-inline-end: 0.75rem; - color: #212529; - background-color: #e9ecef; + color: var(--bs-body-color); + background-color: var(--bs-tertiary-bg); pointer-events: none; border-color: inherit; border-style: solid; border-width: 0; - border-inline-end-width: 1px; + border-inline-end-width: var(--bs-border-width); border-radius: 0; transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; } @media (prefers-reduced-motion: reduce) { .form-control::file-selector-button { transition: none; } } .form-control:hover:not(:disabled):not([readonly])::file-selector-button { - background-color: #dde0e3; } - .form-control::-webkit-file-upload-button { - padding: 0.375rem 0.75rem; - margin: -0.375rem -0.75rem; - margin-inline-end: 0.75rem; - color: #212529; - background-color: #e9ecef; - pointer-events: none; - border-color: inherit; - border-style: solid; - border-width: 0; - border-inline-end-width: 1px; - border-radius: 0; - transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; } - @media (prefers-reduced-motion: reduce) { - .form-control::-webkit-file-upload-button { - transition: none; } } - .form-control:hover:not(:disabled):not([readonly])::-webkit-file-upload-button { - background-color: #dde0e3; } + background-color: var(--bs-secondary-bg); } .form-control-plaintext { display: block; @@ -1609,82 +1746,80 @@ progress { padding: 0.375rem 0; margin-bottom: 0; line-height: 1.5; - color: #212529; + color: var(--bs-body-color); background-color: transparent; border: solid transparent; - border-width: 1px 0; } + border-width: var(--bs-border-width) 0; } + .form-control-plaintext:focus { + outline: 0; } .form-control-plaintext.form-control-sm, .form-control-plaintext.form-control-lg { padding-right: 0; padding-left: 0; } .form-control-sm { - min-height: calc(1.5em + 0.5rem + 2px); + min-height: calc(1.5em + 0.5rem + calc(var(--bs-border-width) * 2)); padding: 0.25rem 0.5rem; font-size: 0.875rem; - border-radius: 0.2rem; } + border-radius: var(--bs-border-radius-sm); } .form-control-sm::file-selector-button { padding: 0.25rem 0.5rem; margin: -0.25rem -0.5rem; margin-inline-end: 0.5rem; } - .form-control-sm::-webkit-file-upload-button { - padding: 0.25rem 0.5rem; - margin: -0.25rem -0.5rem; - margin-inline-end: 0.5rem; } .form-control-lg { - min-height: calc(1.5em + 1rem + 2px); + min-height: calc(1.5em + 1rem + calc(var(--bs-border-width) * 2)); padding: 0.5rem 1rem; font-size: 1.25rem; - border-radius: 0.3rem; } + border-radius: var(--bs-border-radius-lg); } .form-control-lg::file-selector-button { padding: 0.5rem 1rem; margin: -0.5rem -1rem; margin-inline-end: 1rem; } - .form-control-lg::-webkit-file-upload-button { - padding: 0.5rem 1rem; - margin: -0.5rem -1rem; - margin-inline-end: 1rem; } textarea.form-control { - min-height: calc(1.5em + 0.75rem + 2px); } + min-height: calc(1.5em + 0.75rem + calc(var(--bs-border-width) * 2)); } textarea.form-control-sm { - min-height: calc(1.5em + 0.5rem + 2px); } + min-height: calc(1.5em + 0.5rem + calc(var(--bs-border-width) * 2)); } textarea.form-control-lg { - min-height: calc(1.5em + 1rem + 2px); } + min-height: calc(1.5em + 1rem + calc(var(--bs-border-width) * 2)); } .form-control-color { width: 3rem; - height: auto; + height: calc(1.5em + 0.75rem + calc(var(--bs-border-width) * 2)); padding: 0.375rem; } .form-control-color:not(:disabled):not([readonly]) { cursor: pointer; } .form-control-color::-moz-color-swatch { - height: 1.5em; - border-radius: 0.25rem; } + border: 0 !important; + border-radius: var(--bs-border-radius); } .form-control-color::-webkit-color-swatch { - height: 1.5em; - border-radius: 0.25rem; } + border: 0 !important; + border-radius: var(--bs-border-radius); } + .form-control-color.form-control-sm { + height: calc(1.5em + 0.5rem + calc(var(--bs-border-width) * 2)); } + .form-control-color.form-control-lg { + height: calc(1.5em + 1rem + calc(var(--bs-border-width) * 2)); } .form-select { + --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); display: block; width: 100%; padding: 0.375rem 2.25rem 0.375rem 0.75rem; - -moz-padding-start: calc(0.75rem - 3px); font-size: 1rem; font-weight: 400; line-height: 1.5; - color: #212529; - background-color: #fff; - background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"); + color: var(--bs-body-color); + appearance: none; + background-color: var(--bs-body-bg); + background-image: var(--bs-form-select-bg-img), var(--bs-form-select-bg-icon, none); background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 16px 12px; - border: 1px solid #ced4da; - border-radius: 0.25rem; - transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; - appearance: none; } + border: var(--bs-border-width) solid var(--bs-border-color); + border-radius: var(--bs-border-radius); + transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; } @media (prefers-reduced-motion: reduce) { .form-select { transition: none; } } @@ -1696,24 +1831,27 @@ textarea.form-control-lg { padding-right: 0.75rem; background-image: none; } .form-select:disabled { - background-color: #e9ecef; } + background-color: var(--bs-secondary-bg); } .form-select:-moz-focusring { color: transparent; - text-shadow: 0 0 0 #212529; } + text-shadow: 0 0 0 var(--bs-body-color); } .form-select-sm { padding-top: 0.25rem; padding-bottom: 0.25rem; padding-left: 0.5rem; font-size: 0.875rem; - border-radius: 0.2rem; } + border-radius: var(--bs-border-radius-sm); } .form-select-lg { padding-top: 0.5rem; padding-bottom: 0.5rem; padding-left: 1rem; font-size: 1.25rem; - border-radius: 0.3rem; } + border-radius: var(--bs-border-radius-lg); } + +[data-bs-theme="dark"] .form-select { + --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23dee2e6' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); } .form-check { display: block; @@ -1724,18 +1862,30 @@ textarea.form-control-lg { float: left; margin-left: -1.5em; } +.form-check-reverse { + padding-right: 1.5em; + padding-left: 0; + text-align: right; } + .form-check-reverse .form-check-input { + float: right; + margin-right: -1.5em; + margin-left: 0; } + .form-check-input { + --bs-form-check-bg: var(--bs-body-bg); + flex-shrink: 0; width: 1em; height: 1em; margin-top: 0.25em; vertical-align: top; - background-color: #fff; + appearance: none; + background-color: var(--bs-form-check-bg); + background-image: var(--bs-form-check-bg-image); background-repeat: no-repeat; background-position: center; background-size: contain; - border: 1px solid rgba(0, 0, 0, 0.25); - appearance: none; - color-adjust: exact; } + border: var(--bs-border-width) solid var(--bs-border-color); + print-color-adjust: exact; } .form-check-input[type="checkbox"] { border-radius: 0.25em; } .form-check-input[type="radio"] { @@ -1750,26 +1900,28 @@ textarea.form-control-lg { background-color: #0d6efd; border-color: #0d6efd; } .form-check-input[type="checkbox"]:checked { - background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e"); } + --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e"); } .form-check-input[type="radio"]:checked { - background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%23fff'/%3e%3c/svg%3e"); } + --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%23fff'/%3e%3c/svg%3e"); } .form-check-input[type="checkbox"]:indeterminate { background-color: #0d6efd; border-color: #0d6efd; - background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10h8'/%3e%3c/svg%3e"); } + --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10h8'/%3e%3c/svg%3e"); } .form-check-input:disabled { pointer-events: none; filter: none; opacity: 0.5; } .form-check-input[disabled] ~ .form-check-label, .form-check-input:disabled ~ .form-check-label { + cursor: default; opacity: 0.5; } .form-switch { padding-left: 2.5em; } .form-switch .form-check-input { + --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%280, 0, 0, 0.25%29'/%3e%3c/svg%3e"); width: 2em; margin-left: -2.5em; - background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%280, 0, 0, 0.25%29'/%3e%3c/svg%3e"); + background-image: var(--bs-form-switch-bg); background-position: left center; border-radius: 2em; transition: background-position 0.15s ease-in-out; } @@ -1777,10 +1929,16 @@ textarea.form-control-lg { .form-switch .form-check-input { transition: none; } } .form-switch .form-check-input:focus { - background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2386b7fe'/%3e%3c/svg%3e"); } + --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2386b7fe'/%3e%3c/svg%3e"); } .form-switch .form-check-input:checked { background-position: right center; - background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e"); } + --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23fff'/%3e%3c/svg%3e"); } + .form-switch.form-check-reverse { + padding-right: 2.5em; + padding-left: 0; } + .form-switch.form-check-reverse .form-check-input { + margin-right: -2.5em; + margin-left: 0; } .form-check-inline { display: inline-block; @@ -1795,12 +1953,15 @@ textarea.form-control-lg { filter: none; opacity: 0.65; } +[data-bs-theme="dark"] .form-switch .form-check-input:not(:checked):not(:focus) { + --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='rgba%28255, 255, 255, 0.25%29'/%3e%3c/svg%3e"); } + .form-range { width: 100%; height: 1.5rem; padding: 0; - background-color: transparent; - appearance: none; } + appearance: none; + background-color: transparent; } .form-range:focus { outline: 0; } .form-range:focus::-webkit-slider-thumb { @@ -1813,11 +1974,11 @@ textarea.form-control-lg { width: 1rem; height: 1rem; margin-top: -0.25rem; + appearance: none; background-color: #0d6efd; border: 0; border-radius: 1rem; - transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; - appearance: none; } + transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; } @media (prefers-reduced-motion: reduce) { .form-range::-webkit-slider-thumb { transition: none; } } @@ -1828,17 +1989,17 @@ textarea.form-control-lg { height: 0.5rem; color: transparent; cursor: pointer; - background-color: #dee2e6; + background-color: var(--bs-secondary-bg); border-color: transparent; border-radius: 1rem; } .form-range::-moz-range-thumb { width: 1rem; height: 1rem; + appearance: none; background-color: #0d6efd; border: 0; border-radius: 1rem; - transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; - appearance: none; } + transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; } @media (prefers-reduced-motion: reduce) { .form-range::-moz-range-thumb { transition: none; } } @@ -1849,43 +2010,55 @@ textarea.form-control-lg { height: 0.5rem; color: transparent; cursor: pointer; - background-color: #dee2e6; + background-color: var(--bs-secondary-bg); border-color: transparent; border-radius: 1rem; } .form-range:disabled { pointer-events: none; } .form-range:disabled::-webkit-slider-thumb { - background-color: #adb5bd; } + background-color: var(--bs-secondary-color); } .form-range:disabled::-moz-range-thumb { - background-color: #adb5bd; } + background-color: var(--bs-secondary-color); } .form-floating { position: relative; } .form-floating > .form-control, + .form-floating > .form-control-plaintext, .form-floating > .form-select { - height: calc(3.5rem + 2px); + height: calc(3.5rem + calc(var(--bs-border-width) * 2)); + min-height: calc(3.5rem + calc(var(--bs-border-width) * 2)); line-height: 1.25; } .form-floating > label { position: absolute; top: 0; left: 0; + z-index: 2; height: 100%; padding: 1rem 0.75rem; + overflow: hidden; + text-align: start; + text-overflow: ellipsis; + white-space: nowrap; pointer-events: none; - border: 1px solid transparent; + border: var(--bs-border-width) solid transparent; transform-origin: 0 0; transition: opacity 0.1s ease-in-out, transform 0.1s ease-in-out; } @media (prefers-reduced-motion: reduce) { .form-floating > label { transition: none; } } - .form-floating > .form-control { + .form-floating > .form-control, + .form-floating > .form-control-plaintext { padding: 1rem 0.75rem; } - .form-floating > .form-control::placeholder { + .form-floating > .form-control::placeholder, + .form-floating > .form-control-plaintext::placeholder { color: transparent; } - .form-floating > .form-control:focus, .form-floating > .form-control:not(:placeholder-shown) { + .form-floating > .form-control:focus, .form-floating > .form-control:not(:placeholder-shown), + .form-floating > .form-control-plaintext:focus, + .form-floating > .form-control-plaintext:not(:placeholder-shown) { padding-top: 1.625rem; padding-bottom: 0.625rem; } - .form-floating > .form-control:-webkit-autofill { + .form-floating > .form-control:-webkit-autofill, + .form-floating > .form-control-plaintext:-webkit-autofill { padding-top: 1.625rem; padding-bottom: 0.625rem; } .form-floating > .form-select { @@ -1893,12 +2066,32 @@ textarea.form-control-lg { padding-bottom: 0.625rem; } .form-floating > .form-control:focus ~ label, .form-floating > .form-control:not(:placeholder-shown) ~ label, + .form-floating > .form-control-plaintext ~ label, .form-floating > .form-select ~ label { - opacity: 0.65; + color: rgba(var(--bs-body-color-rgb), 0.65); transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem); } + .form-floating > .form-control:focus ~ label::after, + .form-floating > .form-control:not(:placeholder-shown) ~ label::after, + .form-floating > .form-control-plaintext ~ label::after, + .form-floating > .form-select ~ label::after { + position: absolute; + inset: 1rem 0.375rem; + z-index: -1; + height: 1.5em; + content: ""; + background-color: var(--bs-body-bg); + border-radius: var(--bs-border-radius); } .form-floating > .form-control:-webkit-autofill ~ label { - opacity: 0.65; + color: rgba(var(--bs-body-color-rgb), 0.65); transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem); } + .form-floating > .form-control-plaintext ~ label { + border-width: var(--bs-border-width) 0; } + .form-floating > :disabled ~ label, + .form-floating > .form-control:disabled ~ label { + color: #6c757d; } + .form-floating > :disabled ~ label::after, + .form-floating > .form-control:disabled ~ label::after { + background-color: var(--bs-secondary-bg); } .input-group { position: relative; @@ -1907,19 +2100,21 @@ textarea.form-control-lg { align-items: stretch; width: 100%; } .input-group > .form-control, - .input-group > .form-select { + .input-group > .form-select, + .input-group > .form-floating { position: relative; flex: 1 1 auto; width: 1%; min-width: 0; } .input-group > .form-control:focus, - .input-group > .form-select:focus { - z-index: 3; } + .input-group > .form-select:focus, + .input-group > .form-floating:focus-within { + z-index: 5; } .input-group .btn { position: relative; z-index: 2; } .input-group .btn:focus { - z-index: 3; } + z-index: 5; } .input-group-text { display: flex; @@ -1928,12 +2123,12 @@ textarea.form-control-lg { font-size: 1rem; font-weight: 400; line-height: 1.5; - color: #212529; + color: var(--bs-body-color); text-align: center; white-space: nowrap; - background-color: #e9ecef; - border: 1px solid #ced4da; - border-radius: 0.25rem; } + background-color: var(--bs-tertiary-bg); + border: var(--bs-border-width) solid var(--bs-border-color); + border-radius: var(--bs-border-radius); } .input-group-lg > .form-control, .input-group-lg > .form-select, @@ -1941,7 +2136,7 @@ textarea.form-control-lg { .input-group-lg > .btn { padding: 0.5rem 1rem; font-size: 1.25rem; - border-radius: 0.3rem; } + border-radius: var(--bs-border-radius-lg); } .input-group-sm > .form-control, .input-group-sm > .form-select, @@ -1949,24 +2144,33 @@ textarea.form-control-lg { .input-group-sm > .btn { padding: 0.25rem 0.5rem; font-size: 0.875rem; - border-radius: 0.2rem; } + border-radius: var(--bs-border-radius-sm); } .input-group-lg > .form-select, .input-group-sm > .form-select { padding-right: 3rem; } -.input-group:not(.has-validation) > :not(:last-child):not(.dropdown-toggle):not(.dropdown-menu), -.input-group:not(.has-validation) > .dropdown-toggle:nth-last-child(n + 3) { +.input-group:not(.has-validation) > :not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating), +.input-group:not(.has-validation) > .dropdown-toggle:nth-last-child(n + 3), +.input-group:not(.has-validation) > .form-floating:not(:last-child) > .form-control, +.input-group:not(.has-validation) > .form-floating:not(:last-child) > .form-select { border-top-right-radius: 0; border-bottom-right-radius: 0; } -.input-group.has-validation > :nth-last-child(n + 3):not(.dropdown-toggle):not(.dropdown-menu), -.input-group.has-validation > .dropdown-toggle:nth-last-child(n + 4) { +.input-group.has-validation > :nth-last-child(n + 3):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating), +.input-group.has-validation > .dropdown-toggle:nth-last-child(n + 4), +.input-group.has-validation > .form-floating:nth-last-child(n + 3) > .form-control, +.input-group.has-validation > .form-floating:nth-last-child(n + 3) > .form-select { border-top-right-radius: 0; border-bottom-right-radius: 0; } .input-group > :not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) { - margin-left: -1px; + margin-left: calc(var(--bs-border-width) * -1); + border-top-left-radius: 0; + border-bottom-left-radius: 0; } + +.input-group > .form-floating:not(:first-child) > .form-control, +.input-group > .form-floating:not(:first-child) > .form-select { border-top-left-radius: 0; border-bottom-left-radius: 0; } @@ -1975,7 +2179,7 @@ textarea.form-control-lg { width: 100%; margin-top: 0.25rem; font-size: 0.875em; - color: #198754; } + color: var(--bs-form-valid-color); } .valid-tooltip { position: absolute; @@ -1987,8 +2191,8 @@ textarea.form-control-lg { margin-top: .1rem; font-size: 0.875rem; color: #fff; - background-color: rgba(25, 135, 84, 0.9); - border-radius: 0.25rem; } + background-color: var(--bs-success); + border-radius: var(--bs-border-radius); } .was-validated :valid ~ .valid-feedback, .was-validated :valid ~ .valid-tooltip, @@ -1997,56 +2201,57 @@ textarea.form-control-lg { display: block; } .was-validated .form-control:valid, .form-control.is-valid { - border-color: #198754; + border-color: var(--bs-form-valid-border-color); padding-right: calc(1.5em + 0.75rem); - background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e"); + background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right calc(0.375em + 0.1875rem) center; background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem); } .was-validated .form-control:valid:focus, .form-control.is-valid:focus { - border-color: #198754; - box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25); } + border-color: var(--bs-form-valid-border-color); + box-shadow: 0 0 0 0.25rem rgba(var(--bs-success-rgb), 0.25); } .was-validated textarea.form-control:valid, textarea.form-control.is-valid { padding-right: calc(1.5em + 0.75rem); background-position: top calc(0.375em + 0.1875rem) right calc(0.375em + 0.1875rem); } .was-validated .form-select:valid, .form-select.is-valid { - border-color: #198754; } + border-color: var(--bs-form-valid-border-color); } .was-validated .form-select:valid:not([multiple]):not([size]), .was-validated .form-select[size="1"]:valid:not([multiple]), .form-select.is-valid:not([multiple]):not([size]), .form-select.is-valid[size="1"]:not([multiple]) { + --bs-form-select-bg-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e"); padding-right: 4.125rem; - background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"), url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e"); background-position: right 0.75rem center, center right 2.25rem; background-size: 16px 12px, calc(0.75em + 0.375rem) calc(0.75em + 0.375rem); } .was-validated .form-select:valid:focus, .form-select.is-valid:focus { - border-color: #198754; - box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25); } + border-color: var(--bs-form-valid-border-color); + box-shadow: 0 0 0 0.25rem rgba(var(--bs-success-rgb), 0.25); } + +.was-validated .form-control-color:valid, .form-control-color.is-valid { + width: calc(3rem + calc(1.5em + 0.75rem)); } .was-validated .form-check-input:valid, .form-check-input.is-valid { - border-color: #198754; } + border-color: var(--bs-form-valid-border-color); } .was-validated .form-check-input:valid:checked, .form-check-input.is-valid:checked { - background-color: #198754; } + background-color: var(--bs-form-valid-color); } .was-validated .form-check-input:valid:focus, .form-check-input.is-valid:focus { - box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.25); } + box-shadow: 0 0 0 0.25rem rgba(var(--bs-success-rgb), 0.25); } .was-validated .form-check-input:valid ~ .form-check-label, .form-check-input.is-valid ~ .form-check-label { - color: #198754; } + color: var(--bs-form-valid-color); } .form-check-inline .form-check-input ~ .valid-feedback { margin-left: .5em; } -.was-validated .input-group .form-control:valid, .input-group .form-control.is-valid, .was-validated .input-group .form-select:valid, -.input-group .form-select.is-valid { - z-index: 1; } - .was-validated .input-group .form-control:valid:focus, .input-group .form-control.is-valid:focus, .was-validated .input-group .form-select:valid:focus, - .input-group .form-select.is-valid:focus { - z-index: 3; } +.was-validated .input-group > .form-control:not(:focus):valid, .input-group > .form-control.is-valid:not(:focus), .was-validated .input-group > .form-select:not(:focus):valid, +.input-group > .form-select.is-valid:not(:focus), .was-validated .input-group > .form-floating:not(:focus-within):valid, +.input-group > .form-floating.is-valid:not(:focus-within) { + z-index: 3; } .invalid-feedback { display: none; width: 100%; margin-top: 0.25rem; font-size: 0.875em; - color: #dc3545; } + color: var(--bs-form-invalid-color); } .invalid-tooltip { position: absolute; @@ -2058,8 +2263,8 @@ textarea.form-control-lg { margin-top: .1rem; font-size: 0.875rem; color: #fff; - background-color: rgba(220, 53, 69, 0.9); - border-radius: 0.25rem; } + background-color: var(--bs-danger); + border-radius: var(--bs-border-radius); } .was-validated :invalid ~ .invalid-feedback, .was-validated :invalid ~ .invalid-tooltip, @@ -2068,440 +2273,405 @@ textarea.form-control-lg { display: block; } .was-validated .form-control:invalid, .form-control.is-invalid { - border-color: #dc3545; + border-color: var(--bs-form-invalid-border-color); padding-right: calc(1.5em + 0.75rem); background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right calc(0.375em + 0.1875rem) center; background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem); } .was-validated .form-control:invalid:focus, .form-control.is-invalid:focus { - border-color: #dc3545; - box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25); } + border-color: var(--bs-form-invalid-border-color); + box-shadow: 0 0 0 0.25rem rgba(var(--bs-danger-rgb), 0.25); } .was-validated textarea.form-control:invalid, textarea.form-control.is-invalid { padding-right: calc(1.5em + 0.75rem); background-position: top calc(0.375em + 0.1875rem) right calc(0.375em + 0.1875rem); } .was-validated .form-select:invalid, .form-select.is-invalid { - border-color: #dc3545; } + border-color: var(--bs-form-invalid-border-color); } .was-validated .form-select:invalid:not([multiple]):not([size]), .was-validated .form-select[size="1"]:invalid:not([multiple]), .form-select.is-invalid:not([multiple]):not([size]), .form-select.is-invalid[size="1"]:not([multiple]) { + --bs-form-select-bg-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e"); padding-right: 4.125rem; - background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e"), url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e"); background-position: right 0.75rem center, center right 2.25rem; background-size: 16px 12px, calc(0.75em + 0.375rem) calc(0.75em + 0.375rem); } .was-validated .form-select:invalid:focus, .form-select.is-invalid:focus { - border-color: #dc3545; - box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25); } + border-color: var(--bs-form-invalid-border-color); + box-shadow: 0 0 0 0.25rem rgba(var(--bs-danger-rgb), 0.25); } + +.was-validated .form-control-color:invalid, .form-control-color.is-invalid { + width: calc(3rem + calc(1.5em + 0.75rem)); } .was-validated .form-check-input:invalid, .form-check-input.is-invalid { - border-color: #dc3545; } + border-color: var(--bs-form-invalid-border-color); } .was-validated .form-check-input:invalid:checked, .form-check-input.is-invalid:checked { - background-color: #dc3545; } + background-color: var(--bs-form-invalid-color); } .was-validated .form-check-input:invalid:focus, .form-check-input.is-invalid:focus { - box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25); } + box-shadow: 0 0 0 0.25rem rgba(var(--bs-danger-rgb), 0.25); } .was-validated .form-check-input:invalid ~ .form-check-label, .form-check-input.is-invalid ~ .form-check-label { - color: #dc3545; } + color: var(--bs-form-invalid-color); } .form-check-inline .form-check-input ~ .invalid-feedback { margin-left: .5em; } -.was-validated .input-group .form-control:invalid, .input-group .form-control.is-invalid, .was-validated .input-group .form-select:invalid, -.input-group .form-select.is-invalid { - z-index: 2; } - .was-validated .input-group .form-control:invalid:focus, .input-group .form-control.is-invalid:focus, .was-validated .input-group .form-select:invalid:focus, - .input-group .form-select.is-invalid:focus { - z-index: 3; } +.was-validated .input-group > .form-control:not(:focus):invalid, .input-group > .form-control.is-invalid:not(:focus), .was-validated .input-group > .form-select:not(:focus):invalid, +.input-group > .form-select.is-invalid:not(:focus), .was-validated .input-group > .form-floating:not(:focus-within):invalid, +.input-group > .form-floating.is-invalid:not(:focus-within) { + z-index: 4; } .btn { + --bs-btn-padding-x: 0.75rem; + --bs-btn-padding-y: 0.375rem; + --bs-btn-font-family: ; + --bs-btn-font-size: 1rem; + --bs-btn-font-weight: 400; + --bs-btn-line-height: 1.5; + --bs-btn-color: var(--bs-body-color); + --bs-btn-bg: transparent; + --bs-btn-border-width: var(--bs-border-width); + --bs-btn-border-color: transparent; + --bs-btn-border-radius: var(--bs-border-radius); + --bs-btn-hover-border-color: transparent; + --bs-btn-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075); + --bs-btn-disabled-opacity: 0.65; + --bs-btn-focus-box-shadow: 0 0 0 0.25rem rgba(var(--bs-btn-focus-shadow-rgb), .5); display: inline-block; - font-weight: 400; - line-height: 1.5; - color: #212529; + padding: var(--bs-btn-padding-y) var(--bs-btn-padding-x); + font-family: var(--bs-btn-font-family); + font-size: var(--bs-btn-font-size); + font-weight: var(--bs-btn-font-weight); + line-height: var(--bs-btn-line-height); + color: var(--bs-btn-color); text-align: center; text-decoration: none; vertical-align: middle; cursor: pointer; user-select: none; - background-color: transparent; - border: 1px solid transparent; - padding: 0.375rem 0.75rem; - font-size: 1rem; - border-radius: 0.25rem; + border: var(--bs-btn-border-width) solid var(--bs-btn-border-color); + border-radius: var(--bs-btn-border-radius); + background-color: var(--bs-btn-bg); transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; } @media (prefers-reduced-motion: reduce) { .btn { transition: none; } } .btn:hover { - color: #212529; } - .btn-check:focus + .btn, .btn:focus { + color: var(--bs-btn-hover-color); + background-color: var(--bs-btn-hover-bg); + border-color: var(--bs-btn-hover-border-color); } + .btn-check + .btn:hover { + color: var(--bs-btn-color); + background-color: var(--bs-btn-bg); + border-color: var(--bs-btn-border-color); } + .btn:focus-visible { + color: var(--bs-btn-hover-color); + background-color: var(--bs-btn-hover-bg); + border-color: var(--bs-btn-hover-border-color); outline: 0; - box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25); } + box-shadow: var(--bs-btn-focus-box-shadow); } + .btn-check:focus-visible + .btn { + border-color: var(--bs-btn-hover-border-color); + outline: 0; + box-shadow: var(--bs-btn-focus-box-shadow); } + .btn-check:checked + .btn, :not(.btn-check) + .btn:active, .btn:first-child:active, .btn.active, .btn.show { + color: var(--bs-btn-active-color); + background-color: var(--bs-btn-active-bg); + border-color: var(--bs-btn-active-border-color); } + .btn-check:checked + .btn:focus-visible, :not(.btn-check) + .btn:active:focus-visible, .btn:first-child:active:focus-visible, .btn.active:focus-visible, .btn.show:focus-visible { + box-shadow: var(--bs-btn-focus-box-shadow); } + .btn-check:checked:focus-visible + .btn { + box-shadow: var(--bs-btn-focus-box-shadow); } .btn:disabled, .btn.disabled, fieldset:disabled .btn { + color: var(--bs-btn-disabled-color); pointer-events: none; - opacity: 0.65; } + background-color: var(--bs-btn-disabled-bg); + border-color: var(--bs-btn-disabled-border-color); + opacity: var(--bs-btn-disabled-opacity); } .btn-primary { - color: #fff; - background-color: #0d6efd; - border-color: #0d6efd; } - .btn-primary:hover { - color: #fff; - background-color: #0b5ed7; - border-color: #0a58ca; } - .btn-check:focus + .btn-primary, .btn-primary:focus { - color: #fff; - background-color: #0b5ed7; - border-color: #0a58ca; - box-shadow: 0 0 0 0.25rem rgba(49, 132, 253, 0.5); } - .btn-check:checked + .btn-primary, .btn-check:active + .btn-primary, .btn-primary:active, .btn-primary.active, .show > .btn-primary.dropdown-toggle { - color: #fff; - background-color: #0a58ca; - border-color: #0a53be; } - .btn-check:checked + .btn-primary:focus, .btn-check:active + .btn-primary:focus, .btn-primary:active:focus, .btn-primary.active:focus, .show > .btn-primary.dropdown-toggle:focus { - box-shadow: 0 0 0 0.25rem rgba(49, 132, 253, 0.5); } - .btn-primary:disabled, .btn-primary.disabled { - color: #fff; - background-color: #0d6efd; - border-color: #0d6efd; } + --bs-btn-color: #fff; + --bs-btn-bg: #0d6efd; + --bs-btn-border-color: #0d6efd; + --bs-btn-hover-color: #fff; + --bs-btn-hover-bg: #0b5ed7; + --bs-btn-hover-border-color: #0a58ca; + --bs-btn-focus-shadow-rgb: 49, 132, 253; + --bs-btn-active-color: #fff; + --bs-btn-active-bg: #0a58ca; + --bs-btn-active-border-color: #0a53be; + --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + --bs-btn-disabled-color: #fff; + --bs-btn-disabled-bg: #0d6efd; + --bs-btn-disabled-border-color: #0d6efd; } .btn-secondary { - color: #fff; - background-color: #6c757d; - border-color: #6c757d; } - .btn-secondary:hover { - color: #fff; - background-color: #5c636a; - border-color: #565e64; } - .btn-check:focus + .btn-secondary, .btn-secondary:focus { - color: #fff; - background-color: #5c636a; - border-color: #565e64; - box-shadow: 0 0 0 0.25rem rgba(130, 138, 145, 0.5); } - .btn-check:checked + .btn-secondary, .btn-check:active + .btn-secondary, .btn-secondary:active, .btn-secondary.active, .show > .btn-secondary.dropdown-toggle { - color: #fff; - background-color: #565e64; - border-color: #51585e; } - .btn-check:checked + .btn-secondary:focus, .btn-check:active + .btn-secondary:focus, .btn-secondary:active:focus, .btn-secondary.active:focus, .show > .btn-secondary.dropdown-toggle:focus { - box-shadow: 0 0 0 0.25rem rgba(130, 138, 145, 0.5); } - .btn-secondary:disabled, .btn-secondary.disabled { - color: #fff; - background-color: #6c757d; - border-color: #6c757d; } + --bs-btn-color: #fff; + --bs-btn-bg: #6c757d; + --bs-btn-border-color: #6c757d; + --bs-btn-hover-color: #fff; + --bs-btn-hover-bg: #5c636a; + --bs-btn-hover-border-color: #565e64; + --bs-btn-focus-shadow-rgb: 130, 138, 145; + --bs-btn-active-color: #fff; + --bs-btn-active-bg: #565e64; + --bs-btn-active-border-color: #51585e; + --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + --bs-btn-disabled-color: #fff; + --bs-btn-disabled-bg: #6c757d; + --bs-btn-disabled-border-color: #6c757d; } .btn-success { - color: #fff; - background-color: #198754; - border-color: #198754; } - .btn-success:hover { - color: #fff; - background-color: #157347; - border-color: #146c43; } - .btn-check:focus + .btn-success, .btn-success:focus { - color: #fff; - background-color: #157347; - border-color: #146c43; - box-shadow: 0 0 0 0.25rem rgba(60, 153, 110, 0.5); } - .btn-check:checked + .btn-success, .btn-check:active + .btn-success, .btn-success:active, .btn-success.active, .show > .btn-success.dropdown-toggle { - color: #fff; - background-color: #146c43; - border-color: #13653f; } - .btn-check:checked + .btn-success:focus, .btn-check:active + .btn-success:focus, .btn-success:active:focus, .btn-success.active:focus, .show > .btn-success.dropdown-toggle:focus { - box-shadow: 0 0 0 0.25rem rgba(60, 153, 110, 0.5); } - .btn-success:disabled, .btn-success.disabled { - color: #fff; - background-color: #198754; - border-color: #198754; } + --bs-btn-color: #fff; + --bs-btn-bg: #198754; + --bs-btn-border-color: #198754; + --bs-btn-hover-color: #fff; + --bs-btn-hover-bg: #157347; + --bs-btn-hover-border-color: #146c43; + --bs-btn-focus-shadow-rgb: 60, 153, 110; + --bs-btn-active-color: #fff; + --bs-btn-active-bg: #146c43; + --bs-btn-active-border-color: #13653f; + --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + --bs-btn-disabled-color: #fff; + --bs-btn-disabled-bg: #198754; + --bs-btn-disabled-border-color: #198754; } .btn-info { - color: #000; - background-color: #0dcaf0; - border-color: #0dcaf0; } - .btn-info:hover { - color: #000; - background-color: #31d2f2; - border-color: #25cff2; } - .btn-check:focus + .btn-info, .btn-info:focus { - color: #000; - background-color: #31d2f2; - border-color: #25cff2; - box-shadow: 0 0 0 0.25rem rgba(11, 172, 204, 0.5); } - .btn-check:checked + .btn-info, .btn-check:active + .btn-info, .btn-info:active, .btn-info.active, .show > .btn-info.dropdown-toggle { - color: #000; - background-color: #3dd5f3; - border-color: #25cff2; } - .btn-check:checked + .btn-info:focus, .btn-check:active + .btn-info:focus, .btn-info:active:focus, .btn-info.active:focus, .show > .btn-info.dropdown-toggle:focus { - box-shadow: 0 0 0 0.25rem rgba(11, 172, 204, 0.5); } - .btn-info:disabled, .btn-info.disabled { - color: #000; - background-color: #0dcaf0; - border-color: #0dcaf0; } + --bs-btn-color: #000; + --bs-btn-bg: #0dcaf0; + --bs-btn-border-color: #0dcaf0; + --bs-btn-hover-color: #000; + --bs-btn-hover-bg: #31d2f2; + --bs-btn-hover-border-color: #25cff2; + --bs-btn-focus-shadow-rgb: 11, 172, 204; + --bs-btn-active-color: #000; + --bs-btn-active-bg: #3dd5f3; + --bs-btn-active-border-color: #25cff2; + --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + --bs-btn-disabled-color: #000; + --bs-btn-disabled-bg: #0dcaf0; + --bs-btn-disabled-border-color: #0dcaf0; } .btn-warning { - color: #000; - background-color: #ffc107; - border-color: #ffc107; } - .btn-warning:hover { - color: #000; - background-color: #ffca2c; - border-color: #ffc720; } - .btn-check:focus + .btn-warning, .btn-warning:focus { - color: #000; - background-color: #ffca2c; - border-color: #ffc720; - box-shadow: 0 0 0 0.25rem rgba(217, 164, 6, 0.5); } - .btn-check:checked + .btn-warning, .btn-check:active + .btn-warning, .btn-warning:active, .btn-warning.active, .show > .btn-warning.dropdown-toggle { - color: #000; - background-color: #ffcd39; - border-color: #ffc720; } - .btn-check:checked + .btn-warning:focus, .btn-check:active + .btn-warning:focus, .btn-warning:active:focus, .btn-warning.active:focus, .show > .btn-warning.dropdown-toggle:focus { - box-shadow: 0 0 0 0.25rem rgba(217, 164, 6, 0.5); } - .btn-warning:disabled, .btn-warning.disabled { - color: #000; - background-color: #ffc107; - border-color: #ffc107; } + --bs-btn-color: #000; + --bs-btn-bg: #ffc107; + --bs-btn-border-color: #ffc107; + --bs-btn-hover-color: #000; + --bs-btn-hover-bg: #ffca2c; + --bs-btn-hover-border-color: #ffc720; + --bs-btn-focus-shadow-rgb: 217, 164, 6; + --bs-btn-active-color: #000; + --bs-btn-active-bg: #ffcd39; + --bs-btn-active-border-color: #ffc720; + --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + --bs-btn-disabled-color: #000; + --bs-btn-disabled-bg: #ffc107; + --bs-btn-disabled-border-color: #ffc107; } .btn-danger { - color: #fff; - background-color: #dc3545; - border-color: #dc3545; } - .btn-danger:hover { - color: #fff; - background-color: #bb2d3b; - border-color: #b02a37; } - .btn-check:focus + .btn-danger, .btn-danger:focus { - color: #fff; - background-color: #bb2d3b; - border-color: #b02a37; - box-shadow: 0 0 0 0.25rem rgba(225, 83, 97, 0.5); } - .btn-check:checked + .btn-danger, .btn-check:active + .btn-danger, .btn-danger:active, .btn-danger.active, .show > .btn-danger.dropdown-toggle { - color: #fff; - background-color: #b02a37; - border-color: #a52834; } - .btn-check:checked + .btn-danger:focus, .btn-check:active + .btn-danger:focus, .btn-danger:active:focus, .btn-danger.active:focus, .show > .btn-danger.dropdown-toggle:focus { - box-shadow: 0 0 0 0.25rem rgba(225, 83, 97, 0.5); } - .btn-danger:disabled, .btn-danger.disabled { - color: #fff; - background-color: #dc3545; - border-color: #dc3545; } + --bs-btn-color: #fff; + --bs-btn-bg: #dc3545; + --bs-btn-border-color: #dc3545; + --bs-btn-hover-color: #fff; + --bs-btn-hover-bg: #bb2d3b; + --bs-btn-hover-border-color: #b02a37; + --bs-btn-focus-shadow-rgb: 225, 83, 97; + --bs-btn-active-color: #fff; + --bs-btn-active-bg: #b02a37; + --bs-btn-active-border-color: #a52834; + --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + --bs-btn-disabled-color: #fff; + --bs-btn-disabled-bg: #dc3545; + --bs-btn-disabled-border-color: #dc3545; } .btn-light { - color: #000; - background-color: #f8f9fa; - border-color: #f8f9fa; } - .btn-light:hover { - color: #000; - background-color: #f9fafb; - border-color: #f9fafb; } - .btn-check:focus + .btn-light, .btn-light:focus { - color: #000; - background-color: #f9fafb; - border-color: #f9fafb; - box-shadow: 0 0 0 0.25rem rgba(211, 212, 213, 0.5); } - .btn-check:checked + .btn-light, .btn-check:active + .btn-light, .btn-light:active, .btn-light.active, .show > .btn-light.dropdown-toggle { - color: #000; - background-color: #f9fafb; - border-color: #f9fafb; } - .btn-check:checked + .btn-light:focus, .btn-check:active + .btn-light:focus, .btn-light:active:focus, .btn-light.active:focus, .show > .btn-light.dropdown-toggle:focus { - box-shadow: 0 0 0 0.25rem rgba(211, 212, 213, 0.5); } - .btn-light:disabled, .btn-light.disabled { - color: #000; - background-color: #f8f9fa; - border-color: #f8f9fa; } + --bs-btn-color: #000; + --bs-btn-bg: #f8f9fa; + --bs-btn-border-color: #f8f9fa; + --bs-btn-hover-color: #000; + --bs-btn-hover-bg: #d3d4d5; + --bs-btn-hover-border-color: #c6c7c8; + --bs-btn-focus-shadow-rgb: 211, 212, 213; + --bs-btn-active-color: #000; + --bs-btn-active-bg: #c6c7c8; + --bs-btn-active-border-color: #babbbc; + --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + --bs-btn-disabled-color: #000; + --bs-btn-disabled-bg: #f8f9fa; + --bs-btn-disabled-border-color: #f8f9fa; } .btn-dark { - color: #fff; - background-color: #212529; - border-color: #212529; } - .btn-dark:hover { - color: #fff; - background-color: #1c1f23; - border-color: #1a1e21; } - .btn-check:focus + .btn-dark, .btn-dark:focus { - color: #fff; - background-color: #1c1f23; - border-color: #1a1e21; - box-shadow: 0 0 0 0.25rem rgba(66, 70, 73, 0.5); } - .btn-check:checked + .btn-dark, .btn-check:active + .btn-dark, .btn-dark:active, .btn-dark.active, .show > .btn-dark.dropdown-toggle { - color: #fff; - background-color: #1a1e21; - border-color: #191c1f; } - .btn-check:checked + .btn-dark:focus, .btn-check:active + .btn-dark:focus, .btn-dark:active:focus, .btn-dark.active:focus, .show > .btn-dark.dropdown-toggle:focus { - box-shadow: 0 0 0 0.25rem rgba(66, 70, 73, 0.5); } - .btn-dark:disabled, .btn-dark.disabled { - color: #fff; - background-color: #212529; - border-color: #212529; } + --bs-btn-color: #fff; + --bs-btn-bg: #212529; + --bs-btn-border-color: #212529; + --bs-btn-hover-color: #fff; + --bs-btn-hover-bg: #424649; + --bs-btn-hover-border-color: #373b3e; + --bs-btn-focus-shadow-rgb: 66, 70, 73; + --bs-btn-active-color: #fff; + --bs-btn-active-bg: #4d5154; + --bs-btn-active-border-color: #373b3e; + --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + --bs-btn-disabled-color: #fff; + --bs-btn-disabled-bg: #212529; + --bs-btn-disabled-border-color: #212529; } .btn-outline-primary { - color: #0d6efd; - border-color: #0d6efd; } - .btn-outline-primary:hover { - color: #fff; - background-color: #0d6efd; - border-color: #0d6efd; } - .btn-check:focus + .btn-outline-primary, .btn-outline-primary:focus { - box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.5); } - .btn-check:checked + .btn-outline-primary, .btn-check:active + .btn-outline-primary, .btn-outline-primary:active, .btn-outline-primary.active, .btn-outline-primary.dropdown-toggle.show { - color: #fff; - background-color: #0d6efd; - border-color: #0d6efd; } - .btn-check:checked + .btn-outline-primary:focus, .btn-check:active + .btn-outline-primary:focus, .btn-outline-primary:active:focus, .btn-outline-primary.active:focus, .btn-outline-primary.dropdown-toggle.show:focus { - box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.5); } - .btn-outline-primary:disabled, .btn-outline-primary.disabled { - color: #0d6efd; - background-color: transparent; } + --bs-btn-color: #0d6efd; + --bs-btn-border-color: #0d6efd; + --bs-btn-hover-color: #fff; + --bs-btn-hover-bg: #0d6efd; + --bs-btn-hover-border-color: #0d6efd; + --bs-btn-focus-shadow-rgb: 13, 110, 253; + --bs-btn-active-color: #fff; + --bs-btn-active-bg: #0d6efd; + --bs-btn-active-border-color: #0d6efd; + --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + --bs-btn-disabled-color: #0d6efd; + --bs-btn-disabled-bg: transparent; + --bs-btn-disabled-border-color: #0d6efd; + --bs-gradient: none; } .btn-outline-secondary { - color: #6c757d; - border-color: #6c757d; } - .btn-outline-secondary:hover { - color: #fff; - background-color: #6c757d; - border-color: #6c757d; } - .btn-check:focus + .btn-outline-secondary, .btn-outline-secondary:focus { - box-shadow: 0 0 0 0.25rem rgba(108, 117, 125, 0.5); } - .btn-check:checked + .btn-outline-secondary, .btn-check:active + .btn-outline-secondary, .btn-outline-secondary:active, .btn-outline-secondary.active, .btn-outline-secondary.dropdown-toggle.show { - color: #fff; - background-color: #6c757d; - border-color: #6c757d; } - .btn-check:checked + .btn-outline-secondary:focus, .btn-check:active + .btn-outline-secondary:focus, .btn-outline-secondary:active:focus, .btn-outline-secondary.active:focus, .btn-outline-secondary.dropdown-toggle.show:focus { - box-shadow: 0 0 0 0.25rem rgba(108, 117, 125, 0.5); } - .btn-outline-secondary:disabled, .btn-outline-secondary.disabled { - color: #6c757d; - background-color: transparent; } + --bs-btn-color: #6c757d; + --bs-btn-border-color: #6c757d; + --bs-btn-hover-color: #fff; + --bs-btn-hover-bg: #6c757d; + --bs-btn-hover-border-color: #6c757d; + --bs-btn-focus-shadow-rgb: 108, 117, 125; + --bs-btn-active-color: #fff; + --bs-btn-active-bg: #6c757d; + --bs-btn-active-border-color: #6c757d; + --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + --bs-btn-disabled-color: #6c757d; + --bs-btn-disabled-bg: transparent; + --bs-btn-disabled-border-color: #6c757d; + --bs-gradient: none; } .btn-outline-success { - color: #198754; - border-color: #198754; } - .btn-outline-success:hover { - color: #fff; - background-color: #198754; - border-color: #198754; } - .btn-check:focus + .btn-outline-success, .btn-outline-success:focus { - box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.5); } - .btn-check:checked + .btn-outline-success, .btn-check:active + .btn-outline-success, .btn-outline-success:active, .btn-outline-success.active, .btn-outline-success.dropdown-toggle.show { - color: #fff; - background-color: #198754; - border-color: #198754; } - .btn-check:checked + .btn-outline-success:focus, .btn-check:active + .btn-outline-success:focus, .btn-outline-success:active:focus, .btn-outline-success.active:focus, .btn-outline-success.dropdown-toggle.show:focus { - box-shadow: 0 0 0 0.25rem rgba(25, 135, 84, 0.5); } - .btn-outline-success:disabled, .btn-outline-success.disabled { - color: #198754; - background-color: transparent; } + --bs-btn-color: #198754; + --bs-btn-border-color: #198754; + --bs-btn-hover-color: #fff; + --bs-btn-hover-bg: #198754; + --bs-btn-hover-border-color: #198754; + --bs-btn-focus-shadow-rgb: 25, 135, 84; + --bs-btn-active-color: #fff; + --bs-btn-active-bg: #198754; + --bs-btn-active-border-color: #198754; + --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + --bs-btn-disabled-color: #198754; + --bs-btn-disabled-bg: transparent; + --bs-btn-disabled-border-color: #198754; + --bs-gradient: none; } .btn-outline-info { - color: #0dcaf0; - border-color: #0dcaf0; } - .btn-outline-info:hover { - color: #000; - background-color: #0dcaf0; - border-color: #0dcaf0; } - .btn-check:focus + .btn-outline-info, .btn-outline-info:focus { - box-shadow: 0 0 0 0.25rem rgba(13, 202, 240, 0.5); } - .btn-check:checked + .btn-outline-info, .btn-check:active + .btn-outline-info, .btn-outline-info:active, .btn-outline-info.active, .btn-outline-info.dropdown-toggle.show { - color: #000; - background-color: #0dcaf0; - border-color: #0dcaf0; } - .btn-check:checked + .btn-outline-info:focus, .btn-check:active + .btn-outline-info:focus, .btn-outline-info:active:focus, .btn-outline-info.active:focus, .btn-outline-info.dropdown-toggle.show:focus { - box-shadow: 0 0 0 0.25rem rgba(13, 202, 240, 0.5); } - .btn-outline-info:disabled, .btn-outline-info.disabled { - color: #0dcaf0; - background-color: transparent; } + --bs-btn-color: #0dcaf0; + --bs-btn-border-color: #0dcaf0; + --bs-btn-hover-color: #000; + --bs-btn-hover-bg: #0dcaf0; + --bs-btn-hover-border-color: #0dcaf0; + --bs-btn-focus-shadow-rgb: 13, 202, 240; + --bs-btn-active-color: #000; + --bs-btn-active-bg: #0dcaf0; + --bs-btn-active-border-color: #0dcaf0; + --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + --bs-btn-disabled-color: #0dcaf0; + --bs-btn-disabled-bg: transparent; + --bs-btn-disabled-border-color: #0dcaf0; + --bs-gradient: none; } .btn-outline-warning { - color: #ffc107; - border-color: #ffc107; } - .btn-outline-warning:hover { - color: #000; - background-color: #ffc107; - border-color: #ffc107; } - .btn-check:focus + .btn-outline-warning, .btn-outline-warning:focus { - box-shadow: 0 0 0 0.25rem rgba(255, 193, 7, 0.5); } - .btn-check:checked + .btn-outline-warning, .btn-check:active + .btn-outline-warning, .btn-outline-warning:active, .btn-outline-warning.active, .btn-outline-warning.dropdown-toggle.show { - color: #000; - background-color: #ffc107; - border-color: #ffc107; } - .btn-check:checked + .btn-outline-warning:focus, .btn-check:active + .btn-outline-warning:focus, .btn-outline-warning:active:focus, .btn-outline-warning.active:focus, .btn-outline-warning.dropdown-toggle.show:focus { - box-shadow: 0 0 0 0.25rem rgba(255, 193, 7, 0.5); } - .btn-outline-warning:disabled, .btn-outline-warning.disabled { - color: #ffc107; - background-color: transparent; } + --bs-btn-color: #ffc107; + --bs-btn-border-color: #ffc107; + --bs-btn-hover-color: #000; + --bs-btn-hover-bg: #ffc107; + --bs-btn-hover-border-color: #ffc107; + --bs-btn-focus-shadow-rgb: 255, 193, 7; + --bs-btn-active-color: #000; + --bs-btn-active-bg: #ffc107; + --bs-btn-active-border-color: #ffc107; + --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + --bs-btn-disabled-color: #ffc107; + --bs-btn-disabled-bg: transparent; + --bs-btn-disabled-border-color: #ffc107; + --bs-gradient: none; } .btn-outline-danger { - color: #dc3545; - border-color: #dc3545; } - .btn-outline-danger:hover { - color: #fff; - background-color: #dc3545; - border-color: #dc3545; } - .btn-check:focus + .btn-outline-danger, .btn-outline-danger:focus { - box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.5); } - .btn-check:checked + .btn-outline-danger, .btn-check:active + .btn-outline-danger, .btn-outline-danger:active, .btn-outline-danger.active, .btn-outline-danger.dropdown-toggle.show { - color: #fff; - background-color: #dc3545; - border-color: #dc3545; } - .btn-check:checked + .btn-outline-danger:focus, .btn-check:active + .btn-outline-danger:focus, .btn-outline-danger:active:focus, .btn-outline-danger.active:focus, .btn-outline-danger.dropdown-toggle.show:focus { - box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.5); } - .btn-outline-danger:disabled, .btn-outline-danger.disabled { - color: #dc3545; - background-color: transparent; } + --bs-btn-color: #dc3545; + --bs-btn-border-color: #dc3545; + --bs-btn-hover-color: #fff; + --bs-btn-hover-bg: #dc3545; + --bs-btn-hover-border-color: #dc3545; + --bs-btn-focus-shadow-rgb: 220, 53, 69; + --bs-btn-active-color: #fff; + --bs-btn-active-bg: #dc3545; + --bs-btn-active-border-color: #dc3545; + --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + --bs-btn-disabled-color: #dc3545; + --bs-btn-disabled-bg: transparent; + --bs-btn-disabled-border-color: #dc3545; + --bs-gradient: none; } .btn-outline-light { - color: #f8f9fa; - border-color: #f8f9fa; } - .btn-outline-light:hover { - color: #000; - background-color: #f8f9fa; - border-color: #f8f9fa; } - .btn-check:focus + .btn-outline-light, .btn-outline-light:focus { - box-shadow: 0 0 0 0.25rem rgba(248, 249, 250, 0.5); } - .btn-check:checked + .btn-outline-light, .btn-check:active + .btn-outline-light, .btn-outline-light:active, .btn-outline-light.active, .btn-outline-light.dropdown-toggle.show { - color: #000; - background-color: #f8f9fa; - border-color: #f8f9fa; } - .btn-check:checked + .btn-outline-light:focus, .btn-check:active + .btn-outline-light:focus, .btn-outline-light:active:focus, .btn-outline-light.active:focus, .btn-outline-light.dropdown-toggle.show:focus { - box-shadow: 0 0 0 0.25rem rgba(248, 249, 250, 0.5); } - .btn-outline-light:disabled, .btn-outline-light.disabled { - color: #f8f9fa; - background-color: transparent; } + --bs-btn-color: #f8f9fa; + --bs-btn-border-color: #f8f9fa; + --bs-btn-hover-color: #000; + --bs-btn-hover-bg: #f8f9fa; + --bs-btn-hover-border-color: #f8f9fa; + --bs-btn-focus-shadow-rgb: 248, 249, 250; + --bs-btn-active-color: #000; + --bs-btn-active-bg: #f8f9fa; + --bs-btn-active-border-color: #f8f9fa; + --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + --bs-btn-disabled-color: #f8f9fa; + --bs-btn-disabled-bg: transparent; + --bs-btn-disabled-border-color: #f8f9fa; + --bs-gradient: none; } .btn-outline-dark { - color: #212529; - border-color: #212529; } - .btn-outline-dark:hover { - color: #fff; - background-color: #212529; - border-color: #212529; } - .btn-check:focus + .btn-outline-dark, .btn-outline-dark:focus { - box-shadow: 0 0 0 0.25rem rgba(33, 37, 41, 0.5); } - .btn-check:checked + .btn-outline-dark, .btn-check:active + .btn-outline-dark, .btn-outline-dark:active, .btn-outline-dark.active, .btn-outline-dark.dropdown-toggle.show { - color: #fff; - background-color: #212529; - border-color: #212529; } - .btn-check:checked + .btn-outline-dark:focus, .btn-check:active + .btn-outline-dark:focus, .btn-outline-dark:active:focus, .btn-outline-dark.active:focus, .btn-outline-dark.dropdown-toggle.show:focus { - box-shadow: 0 0 0 0.25rem rgba(33, 37, 41, 0.5); } - .btn-outline-dark:disabled, .btn-outline-dark.disabled { - color: #212529; - background-color: transparent; } + --bs-btn-color: #212529; + --bs-btn-border-color: #212529; + --bs-btn-hover-color: #fff; + --bs-btn-hover-bg: #212529; + --bs-btn-hover-border-color: #212529; + --bs-btn-focus-shadow-rgb: 33, 37, 41; + --bs-btn-active-color: #fff; + --bs-btn-active-bg: #212529; + --bs-btn-active-border-color: #212529; + --bs-btn-active-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125); + --bs-btn-disabled-color: #212529; + --bs-btn-disabled-bg: transparent; + --bs-btn-disabled-border-color: #212529; + --bs-gradient: none; } .btn-link { - font-weight: 400; - color: #0d6efd; + --bs-btn-font-weight: 400; + --bs-btn-color: var(--bs-link-color); + --bs-btn-bg: transparent; + --bs-btn-border-color: transparent; + --bs-btn-hover-color: var(--bs-link-hover-color); + --bs-btn-hover-border-color: transparent; + --bs-btn-active-color: var(--bs-link-hover-color); + --bs-btn-active-border-color: transparent; + --bs-btn-disabled-color: #6c757d; + --bs-btn-disabled-border-color: transparent; + --bs-btn-box-shadow: 0 0 0 #000; + --bs-btn-focus-shadow-rgb: 49, 132, 253; text-decoration: underline; } + .btn-link:focus-visible { + color: var(--bs-btn-color); } .btn-link:hover { - color: #0a58ca; } - .btn-link:disabled, .btn-link.disabled { - color: #6c757d; } + color: var(--bs-btn-hover-color); } .btn-lg, .btn-group-lg > .btn { - padding: 0.5rem 1rem; - font-size: 1.25rem; - border-radius: 0.3rem; } + --bs-btn-padding-y: 0.5rem; + --bs-btn-padding-x: 1rem; + --bs-btn-font-size: 1.25rem; + --bs-btn-border-radius: var(--bs-border-radius-lg); } .btn-sm, .btn-group-sm > .btn { - padding: 0.25rem 0.5rem; - font-size: 0.875rem; - border-radius: 0.2rem; } + --bs-btn-padding-y: 0.25rem; + --bs-btn-padding-x: 0.5rem; + --bs-btn-font-size: 0.875rem; + --bs-btn-border-radius: var(--bs-border-radius-sm); } .fade { transition: opacity 0.15s linear; } @@ -2531,7 +2701,9 @@ textarea.form-control-lg { .dropup, .dropend, .dropdown, -.dropstart { +.dropstart, +.dropup-center, +.dropdown-center { position: relative; } .dropdown-toggle { @@ -2549,24 +2721,50 @@ textarea.form-control-lg { margin-left: 0; } .dropdown-menu { + --bs-dropdown-zindex: 1000; + --bs-dropdown-min-width: 10rem; + --bs-dropdown-padding-x: 0; + --bs-dropdown-padding-y: 0.5rem; + --bs-dropdown-spacer: 0.125rem; + --bs-dropdown-font-size: 1rem; + --bs-dropdown-color: var(--bs-body-color); + --bs-dropdown-bg: var(--bs-body-bg); + --bs-dropdown-border-color: var(--bs-border-color-translucent); + --bs-dropdown-border-radius: var(--bs-border-radius); + --bs-dropdown-border-width: var(--bs-border-width); + --bs-dropdown-inner-border-radius: calc(var(--bs-border-radius) - var(--bs-border-width)); + --bs-dropdown-divider-bg: var(--bs-border-color-translucent); + --bs-dropdown-divider-margin-y: 0.5rem; + --bs-dropdown-box-shadow: var(--bs-box-shadow); + --bs-dropdown-link-color: var(--bs-body-color); + --bs-dropdown-link-hover-color: var(--bs-body-color); + --bs-dropdown-link-hover-bg: var(--bs-tertiary-bg); + --bs-dropdown-link-active-color: #fff; + --bs-dropdown-link-active-bg: #0d6efd; + --bs-dropdown-link-disabled-color: var(--bs-tertiary-color); + --bs-dropdown-item-padding-x: 1rem; + --bs-dropdown-item-padding-y: 0.25rem; + --bs-dropdown-header-color: #6c757d; + --bs-dropdown-header-padding-x: 1rem; + --bs-dropdown-header-padding-y: 0.5rem; position: absolute; - z-index: 1000; + z-index: var(--bs-dropdown-zindex); display: none; - min-width: 10rem; - padding: 0.5rem 0; + min-width: var(--bs-dropdown-min-width); + padding: var(--bs-dropdown-padding-y) var(--bs-dropdown-padding-x); margin: 0; - font-size: 1rem; - color: #212529; + font-size: var(--bs-dropdown-font-size); + color: var(--bs-dropdown-color); text-align: left; list-style: none; - background-color: #fff; + background-color: var(--bs-dropdown-bg); background-clip: padding-box; - border: 1px solid rgba(0, 0, 0, 0.15); - border-radius: 0.25rem; } + border: var(--bs-dropdown-border-width) solid var(--bs-dropdown-border-color); + border-radius: var(--bs-dropdown-border-radius); } .dropdown-menu[data-bs-popper] { top: 100%; left: 0; - margin-top: 0.125rem; } + margin-top: var(--bs-dropdown-spacer); } .dropdown-menu-start { --bs-position: start; } @@ -2644,7 +2842,7 @@ textarea.form-control-lg { top: auto; bottom: 100%; margin-top: 0; - margin-bottom: 0.125rem; } + margin-bottom: var(--bs-dropdown-spacer); } .dropup .dropdown-toggle::after { display: inline-block; @@ -2664,7 +2862,7 @@ textarea.form-control-lg { right: auto; left: 100%; margin-top: 0; - margin-left: 0.125rem; } + margin-left: var(--bs-dropdown-spacer); } .dropend .dropdown-toggle::after { display: inline-block; @@ -2687,7 +2885,7 @@ textarea.form-control-lg { right: 100%; left: auto; margin-top: 0; - margin-right: 0.125rem; } + margin-right: var(--bs-dropdown-spacer); } .dropstart .dropdown-toggle::after { display: inline-block; @@ -2715,31 +2913,33 @@ textarea.form-control-lg { .dropdown-divider { height: 0; - margin: 0.5rem 0; + margin: var(--bs-dropdown-divider-margin-y) 0; overflow: hidden; - border-top: 1px solid rgba(0, 0, 0, 0.15); } + border-top: 1px solid var(--bs-dropdown-divider-bg); + opacity: 1; } .dropdown-item { display: block; width: 100%; - padding: 0.25rem 1rem; + padding: var(--bs-dropdown-item-padding-y) var(--bs-dropdown-item-padding-x); clear: both; font-weight: 400; - color: #212529; + color: var(--bs-dropdown-link-color); text-align: inherit; text-decoration: none; white-space: nowrap; background-color: transparent; - border: 0; } + border: 0; + border-radius: var(--bs-dropdown-item-border-radius, 0); } .dropdown-item:hover, .dropdown-item:focus { - color: #1e2125; - background-color: #e9ecef; } + color: var(--bs-dropdown-link-hover-color); + background-color: var(--bs-dropdown-link-hover-bg); } .dropdown-item.active, .dropdown-item:active { - color: #fff; + color: var(--bs-dropdown-link-active-color); text-decoration: none; - background-color: #0d6efd; } + background-color: var(--bs-dropdown-link-active-bg); } .dropdown-item.disabled, .dropdown-item:disabled { - color: #adb5bd; + color: var(--bs-dropdown-link-disabled-color); pointer-events: none; background-color: transparent; } @@ -2748,37 +2948,30 @@ textarea.form-control-lg { .dropdown-header { display: block; - padding: 0.5rem 1rem; + padding: var(--bs-dropdown-header-padding-y) var(--bs-dropdown-header-padding-x); margin-bottom: 0; font-size: 0.875rem; - color: #6c757d; + color: var(--bs-dropdown-header-color); white-space: nowrap; } .dropdown-item-text { display: block; - padding: 0.25rem 1rem; - color: #212529; } + padding: var(--bs-dropdown-item-padding-y) var(--bs-dropdown-item-padding-x); + color: var(--bs-dropdown-link-color); } .dropdown-menu-dark { - color: #dee2e6; - background-color: #343a40; - border-color: rgba(0, 0, 0, 0.15); } - .dropdown-menu-dark .dropdown-item { - color: #dee2e6; } - .dropdown-menu-dark .dropdown-item:hover, .dropdown-menu-dark .dropdown-item:focus { - color: #fff; - background-color: rgba(255, 255, 255, 0.15); } - .dropdown-menu-dark .dropdown-item.active, .dropdown-menu-dark .dropdown-item:active { - color: #fff; - background-color: #0d6efd; } - .dropdown-menu-dark .dropdown-item.disabled, .dropdown-menu-dark .dropdown-item:disabled { - color: #adb5bd; } - .dropdown-menu-dark .dropdown-divider { - border-color: rgba(0, 0, 0, 0.15); } - .dropdown-menu-dark .dropdown-item-text { - color: #dee2e6; } - .dropdown-menu-dark .dropdown-header { - color: #adb5bd; } + --bs-dropdown-color: #dee2e6; + --bs-dropdown-bg: #343a40; + --bs-dropdown-border-color: var(--bs-border-color-translucent); + --bs-dropdown-box-shadow: ; + --bs-dropdown-link-color: #dee2e6; + --bs-dropdown-link-hover-color: #fff; + --bs-dropdown-divider-bg: var(--bs-border-color-translucent); + --bs-dropdown-link-hover-bg: rgba(255, 255, 255, 0.15); + --bs-dropdown-link-active-color: #fff; + --bs-dropdown-link-active-bg: #0d6efd; + --bs-dropdown-link-disabled-color: #adb5bd; + --bs-dropdown-header-color: #adb5bd; } .btn-group, .btn-group-vertical { @@ -2810,20 +3003,21 @@ textarea.form-control-lg { .btn-toolbar .input-group { width: auto; } -.btn-group > .btn:not(:first-child), -.btn-group > .btn-group:not(:first-child) { - margin-left: -1px; } - -.btn-group > .btn:not(:last-child):not(.dropdown-toggle), -.btn-group > .btn-group:not(:last-child) > .btn { - border-top-right-radius: 0; - border-bottom-right-radius: 0; } - -.btn-group > .btn:nth-child(n + 3), -.btn-group > :not(.btn-check) + .btn, -.btn-group > .btn-group:not(:first-child) > .btn { - border-top-left-radius: 0; - border-bottom-left-radius: 0; } +.btn-group { + border-radius: var(--bs-border-radius); } + .btn-group > :not(.btn-check:first-child) + .btn, + .btn-group > .btn-group:not(:first-child) { + margin-left: calc(var(--bs-border-width) * -1); } + .btn-group > .btn:not(:last-child):not(.dropdown-toggle), + .btn-group > .btn.dropdown-toggle-split:first-child, + .btn-group > .btn-group:not(:last-child) > .btn { + border-top-right-radius: 0; + border-bottom-right-radius: 0; } + .btn-group > .btn:nth-child(n + 3), + .btn-group > :not(.btn-check) + .btn, + .btn-group > .btn-group:not(:first-child) > .btn { + border-top-left-radius: 0; + border-bottom-left-radius: 0; } .dropdown-toggle-split { padding-right: 0.5625rem; @@ -2850,7 +3044,7 @@ textarea.form-control-lg { width: 100%; } .btn-group-vertical > .btn:not(:first-child), .btn-group-vertical > .btn-group:not(:first-child) { - margin-top: -1px; } + margin-top: calc(var(--bs-border-width) * -1); } .btn-group-vertical > .btn:not(:last-child):not(.dropdown-toggle), .btn-group-vertical > .btn-group:not(:last-child) > .btn { border-bottom-right-radius: 0; @@ -2861,6 +3055,12 @@ textarea.form-control-lg { border-top-right-radius: 0; } .nav { + --bs-nav-link-padding-x: 1rem; + --bs-nav-link-padding-y: 0.5rem; + --bs-nav-link-font-weight: ; + --bs-nav-link-color: var(--bs-link-color); + --bs-nav-link-hover-color: var(--bs-link-hover-color); + --bs-nav-link-disabled-color: var(--bs-secondary-color); display: flex; flex-wrap: wrap; padding-left: 0; @@ -2869,54 +3069,81 @@ textarea.form-control-lg { .nav-link { display: block; - padding: 0.5rem 1rem; - color: #0d6efd; + padding: var(--bs-nav-link-padding-y) var(--bs-nav-link-padding-x); + font-size: var(--bs-nav-link-font-size); + font-weight: var(--bs-nav-link-font-weight); + color: var(--bs-nav-link-color); text-decoration: none; + background: none; + border: 0; transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out; } @media (prefers-reduced-motion: reduce) { .nav-link { transition: none; } } .nav-link:hover, .nav-link:focus { - color: #0a58ca; } - .nav-link.disabled { - color: #6c757d; + color: var(--bs-nav-link-hover-color); } + .nav-link:focus-visible { + outline: 0; + box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25); } + .nav-link.disabled, .nav-link:disabled { + color: var(--bs-nav-link-disabled-color); pointer-events: none; cursor: default; } .nav-tabs { - border-bottom: 1px solid #dee2e6; } + --bs-nav-tabs-border-width: var(--bs-border-width); + --bs-nav-tabs-border-color: var(--bs-border-color); + --bs-nav-tabs-border-radius: var(--bs-border-radius); + --bs-nav-tabs-link-hover-border-color: var(--bs-secondary-bg) var(--bs-secondary-bg) var(--bs-border-color); + --bs-nav-tabs-link-active-color: var(--bs-emphasis-color); + --bs-nav-tabs-link-active-bg: var(--bs-body-bg); + --bs-nav-tabs-link-active-border-color: var(--bs-border-color) var(--bs-border-color) var(--bs-body-bg); + border-bottom: var(--bs-nav-tabs-border-width) solid var(--bs-nav-tabs-border-color); } .nav-tabs .nav-link { - margin-bottom: -1px; - background: none; - border: 1px solid transparent; - border-top-left-radius: 0.25rem; - border-top-right-radius: 0.25rem; } + margin-bottom: calc(-1 * var(--bs-nav-tabs-border-width)); + border: var(--bs-nav-tabs-border-width) solid transparent; + border-top-left-radius: var(--bs-nav-tabs-border-radius); + border-top-right-radius: var(--bs-nav-tabs-border-radius); } .nav-tabs .nav-link:hover, .nav-tabs .nav-link:focus { - border-color: #e9ecef #e9ecef #dee2e6; - isolation: isolate; } - .nav-tabs .nav-link.disabled { - color: #6c757d; - background-color: transparent; - border-color: transparent; } + isolation: isolate; + border-color: var(--bs-nav-tabs-link-hover-border-color); } .nav-tabs .nav-link.active, .nav-tabs .nav-item.show .nav-link { - color: #495057; - background-color: #fff; - border-color: #dee2e6 #dee2e6 #fff; } + color: var(--bs-nav-tabs-link-active-color); + background-color: var(--bs-nav-tabs-link-active-bg); + border-color: var(--bs-nav-tabs-link-active-border-color); } .nav-tabs .dropdown-menu { - margin-top: -1px; + margin-top: calc(-1 * var(--bs-nav-tabs-border-width)); border-top-left-radius: 0; border-top-right-radius: 0; } -.nav-pills .nav-link { - background: none; - border: 0; - border-radius: 0.25rem; } +.nav-pills { + --bs-nav-pills-border-radius: var(--bs-border-radius); + --bs-nav-pills-link-active-color: #fff; + --bs-nav-pills-link-active-bg: #0d6efd; } + .nav-pills .nav-link { + border-radius: var(--bs-nav-pills-border-radius); } + .nav-pills .nav-link.active, + .nav-pills .show > .nav-link { + color: var(--bs-nav-pills-link-active-color); + background-color: var(--bs-nav-pills-link-active-bg); } -.nav-pills .nav-link.active, -.nav-pills .show > .nav-link { - color: #fff; - background-color: #0d6efd; } +.nav-underline { + --bs-nav-underline-gap: 1rem; + --bs-nav-underline-border-width: 0.125rem; + --bs-nav-underline-link-active-color: var(--bs-emphasis-color); + gap: var(--bs-nav-underline-gap); } + .nav-underline .nav-link { + padding-right: 0; + padding-left: 0; + border-bottom: var(--bs-nav-underline-border-width) solid transparent; } + .nav-underline .nav-link:hover, .nav-underline .nav-link:focus { + border-bottom-color: currentcolor; } + .nav-underline .nav-link.active, + .nav-underline .show > .nav-link { + font-weight: 700; + color: var(--bs-nav-underline-link-active-color); + border-bottom-color: currentcolor; } .nav-fill > .nav-link, .nav-fill .nav-item { @@ -2940,13 +3167,32 @@ textarea.form-control-lg { display: block; } .navbar { + --bs-navbar-padding-x: 0; + --bs-navbar-padding-y: 0.5rem; + --bs-navbar-color: rgba(var(--bs-emphasis-color-rgb), 0.65); + --bs-navbar-hover-color: rgba(var(--bs-emphasis-color-rgb), 0.8); + --bs-navbar-disabled-color: rgba(var(--bs-emphasis-color-rgb), 0.3); + --bs-navbar-active-color: rgba(var(--bs-emphasis-color-rgb), 1); + --bs-navbar-brand-padding-y: 0.3125rem; + --bs-navbar-brand-margin-end: 1rem; + --bs-navbar-brand-font-size: 1.25rem; + --bs-navbar-brand-color: rgba(var(--bs-emphasis-color-rgb), 1); + --bs-navbar-brand-hover-color: rgba(var(--bs-emphasis-color-rgb), 1); + --bs-navbar-nav-link-padding-x: 0.5rem; + --bs-navbar-toggler-padding-y: 0.25rem; + --bs-navbar-toggler-padding-x: 0.75rem; + --bs-navbar-toggler-font-size: 1.25rem; + --bs-navbar-toggler-icon-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%2833, 37, 41, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e"); + --bs-navbar-toggler-border-color: rgba(var(--bs-emphasis-color-rgb), 0.15); + --bs-navbar-toggler-border-radius: var(--bs-border-radius); + --bs-navbar-toggler-focus-width: 0.25rem; + --bs-navbar-toggler-transition: box-shadow 0.15s ease-in-out; position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; - padding-top: 0.5rem; - padding-bottom: 0.5rem; } + padding: var(--bs-navbar-padding-y) var(--bs-navbar-padding-x); } .navbar > .container, .navbar > .container-fluid, .navbar > .container-sm, @@ -2960,28 +3206,41 @@ textarea.form-control-lg { justify-content: space-between; } .navbar-brand { - padding-top: 0.3125rem; - padding-bottom: 0.3125rem; - margin-right: 1rem; - font-size: 1.25rem; + padding-top: var(--bs-navbar-brand-padding-y); + padding-bottom: var(--bs-navbar-brand-padding-y); + margin-right: var(--bs-navbar-brand-margin-end); + font-size: var(--bs-navbar-brand-font-size); + color: var(--bs-navbar-brand-color); text-decoration: none; white-space: nowrap; } + .navbar-brand:hover, .navbar-brand:focus { + color: var(--bs-navbar-brand-hover-color); } .navbar-nav { + --bs-nav-link-padding-x: 0; + --bs-nav-link-padding-y: 0.5rem; + --bs-nav-link-font-weight: ; + --bs-nav-link-color: var(--bs-navbar-color); + --bs-nav-link-hover-color: var(--bs-navbar-hover-color); + --bs-nav-link-disabled-color: var(--bs-navbar-disabled-color); display: flex; flex-direction: column; padding-left: 0; margin-bottom: 0; list-style: none; } - .navbar-nav .nav-link { - padding-right: 0; - padding-left: 0; } + .navbar-nav .nav-link.active, .navbar-nav .nav-link.show { + color: var(--bs-navbar-active-color); } .navbar-nav .dropdown-menu { position: static; } .navbar-text { padding-top: 0.5rem; - padding-bottom: 0.5rem; } + padding-bottom: 0.5rem; + color: var(--bs-navbar-color); } + .navbar-text a, + .navbar-text a:hover, + .navbar-text a:focus { + color: var(--bs-navbar-active-color); } .navbar-collapse { flex-basis: 100%; @@ -2989,13 +3248,14 @@ textarea.form-control-lg { align-items: center; } .navbar-toggler { - padding: 0.25rem 0.75rem; - font-size: 1.25rem; + padding: var(--bs-navbar-toggler-padding-y) var(--bs-navbar-toggler-padding-x); + font-size: var(--bs-navbar-toggler-font-size); line-height: 1; + color: var(--bs-navbar-color); background-color: transparent; - border: 1px solid transparent; - border-radius: 0.25rem; - transition: box-shadow 0.15s ease-in-out; } + border: var(--bs-border-width) solid var(--bs-navbar-toggler-border-color); + border-radius: var(--bs-navbar-toggler-border-radius); + transition: var(--bs-navbar-toggler-transition); } @media (prefers-reduced-motion: reduce) { .navbar-toggler { transition: none; } } @@ -3004,13 +3264,14 @@ textarea.form-control-lg { .navbar-toggler:focus { text-decoration: none; outline: 0; - box-shadow: 0 0 0 0.25rem; } + box-shadow: 0 0 0 var(--bs-navbar-toggler-focus-width); } .navbar-toggler-icon { display: inline-block; width: 1.5em; height: 1.5em; vertical-align: middle; + background-image: var(--bs-navbar-toggler-icon-bg); background-repeat: no-repeat; background-position: center; background-size: 100%; } @@ -3028,8 +3289,8 @@ textarea.form-control-lg { .navbar-expand-sm .navbar-nav .dropdown-menu { position: absolute; } .navbar-expand-sm .navbar-nav .nav-link { - padding-right: 0.5rem; - padding-left: 0.5rem; } + padding-right: var(--bs-navbar-nav-link-padding-x); + padding-left: var(--bs-navbar-nav-link-padding-x); } .navbar-expand-sm .navbar-nav-scroll { overflow: visible; } .navbar-expand-sm .navbar-collapse { @@ -3037,29 +3298,24 @@ textarea.form-control-lg { flex-basis: auto; } .navbar-expand-sm .navbar-toggler { display: none; } - .navbar-expand-sm .offcanvas-header { - display: none; } .navbar-expand-sm .offcanvas { - position: inherit; - bottom: 0; - z-index: 1000; + position: static; + z-index: auto; flex-grow: 1; + width: auto !important; + height: auto !important; visibility: visible !important; - background-color: transparent; - border-right: 0; - border-left: 0; - transition: none; - transform: none; } - .navbar-expand-sm .offcanvas-top, - .navbar-expand-sm .offcanvas-bottom { - height: auto; - border-top: 0; - border-bottom: 0; } - .navbar-expand-sm .offcanvas-body { - display: flex; - flex-grow: 0; - padding: 0; - overflow-y: visible; } } + background-color: transparent !important; + border: 0 !important; + transform: none !important; + transition: none; } + .navbar-expand-sm .offcanvas .offcanvas-header { + display: none; } + .navbar-expand-sm .offcanvas .offcanvas-body { + display: flex; + flex-grow: 0; + padding: 0; + overflow-y: visible; } } @media (min-width: 768px) { .navbar-expand-md { @@ -3070,8 +3326,8 @@ textarea.form-control-lg { .navbar-expand-md .navbar-nav .dropdown-menu { position: absolute; } .navbar-expand-md .navbar-nav .nav-link { - padding-right: 0.5rem; - padding-left: 0.5rem; } + padding-right: var(--bs-navbar-nav-link-padding-x); + padding-left: var(--bs-navbar-nav-link-padding-x); } .navbar-expand-md .navbar-nav-scroll { overflow: visible; } .navbar-expand-md .navbar-collapse { @@ -3079,29 +3335,24 @@ textarea.form-control-lg { flex-basis: auto; } .navbar-expand-md .navbar-toggler { display: none; } - .navbar-expand-md .offcanvas-header { - display: none; } .navbar-expand-md .offcanvas { - position: inherit; - bottom: 0; - z-index: 1000; + position: static; + z-index: auto; flex-grow: 1; + width: auto !important; + height: auto !important; visibility: visible !important; - background-color: transparent; - border-right: 0; - border-left: 0; - transition: none; - transform: none; } - .navbar-expand-md .offcanvas-top, - .navbar-expand-md .offcanvas-bottom { - height: auto; - border-top: 0; - border-bottom: 0; } - .navbar-expand-md .offcanvas-body { - display: flex; - flex-grow: 0; - padding: 0; - overflow-y: visible; } } + background-color: transparent !important; + border: 0 !important; + transform: none !important; + transition: none; } + .navbar-expand-md .offcanvas .offcanvas-header { + display: none; } + .navbar-expand-md .offcanvas .offcanvas-body { + display: flex; + flex-grow: 0; + padding: 0; + overflow-y: visible; } } @media (min-width: 992px) { .navbar-expand-lg { @@ -3112,8 +3363,8 @@ textarea.form-control-lg { .navbar-expand-lg .navbar-nav .dropdown-menu { position: absolute; } .navbar-expand-lg .navbar-nav .nav-link { - padding-right: 0.5rem; - padding-left: 0.5rem; } + padding-right: var(--bs-navbar-nav-link-padding-x); + padding-left: var(--bs-navbar-nav-link-padding-x); } .navbar-expand-lg .navbar-nav-scroll { overflow: visible; } .navbar-expand-lg .navbar-collapse { @@ -3121,29 +3372,24 @@ textarea.form-control-lg { flex-basis: auto; } .navbar-expand-lg .navbar-toggler { display: none; } - .navbar-expand-lg .offcanvas-header { - display: none; } .navbar-expand-lg .offcanvas { - position: inherit; - bottom: 0; - z-index: 1000; + position: static; + z-index: auto; flex-grow: 1; + width: auto !important; + height: auto !important; visibility: visible !important; - background-color: transparent; - border-right: 0; - border-left: 0; - transition: none; - transform: none; } - .navbar-expand-lg .offcanvas-top, - .navbar-expand-lg .offcanvas-bottom { - height: auto; - border-top: 0; - border-bottom: 0; } - .navbar-expand-lg .offcanvas-body { - display: flex; - flex-grow: 0; - padding: 0; - overflow-y: visible; } } + background-color: transparent !important; + border: 0 !important; + transform: none !important; + transition: none; } + .navbar-expand-lg .offcanvas .offcanvas-header { + display: none; } + .navbar-expand-lg .offcanvas .offcanvas-body { + display: flex; + flex-grow: 0; + padding: 0; + overflow-y: visible; } } @media (min-width: 1200px) { .navbar-expand-xl { @@ -3154,8 +3400,8 @@ textarea.form-control-lg { .navbar-expand-xl .navbar-nav .dropdown-menu { position: absolute; } .navbar-expand-xl .navbar-nav .nav-link { - padding-right: 0.5rem; - padding-left: 0.5rem; } + padding-right: var(--bs-navbar-nav-link-padding-x); + padding-left: var(--bs-navbar-nav-link-padding-x); } .navbar-expand-xl .navbar-nav-scroll { overflow: visible; } .navbar-expand-xl .navbar-collapse { @@ -3163,29 +3409,24 @@ textarea.form-control-lg { flex-basis: auto; } .navbar-expand-xl .navbar-toggler { display: none; } - .navbar-expand-xl .offcanvas-header { - display: none; } .navbar-expand-xl .offcanvas { - position: inherit; - bottom: 0; - z-index: 1000; + position: static; + z-index: auto; flex-grow: 1; + width: auto !important; + height: auto !important; visibility: visible !important; - background-color: transparent; - border-right: 0; - border-left: 0; - transition: none; - transform: none; } - .navbar-expand-xl .offcanvas-top, - .navbar-expand-xl .offcanvas-bottom { - height: auto; - border-top: 0; - border-bottom: 0; } - .navbar-expand-xl .offcanvas-body { - display: flex; - flex-grow: 0; - padding: 0; - overflow-y: visible; } } + background-color: transparent !important; + border: 0 !important; + transform: none !important; + transition: none; } + .navbar-expand-xl .offcanvas .offcanvas-header { + display: none; } + .navbar-expand-xl .offcanvas .offcanvas-body { + display: flex; + flex-grow: 0; + padding: 0; + overflow-y: visible; } } @media (min-width: 1400px) { .navbar-expand-xxl { @@ -3196,8 +3437,8 @@ textarea.form-control-lg { .navbar-expand-xxl .navbar-nav .dropdown-menu { position: absolute; } .navbar-expand-xxl .navbar-nav .nav-link { - padding-right: 0.5rem; - padding-left: 0.5rem; } + padding-right: var(--bs-navbar-nav-link-padding-x); + padding-left: var(--bs-navbar-nav-link-padding-x); } .navbar-expand-xxl .navbar-nav-scroll { overflow: visible; } .navbar-expand-xxl .navbar-collapse { @@ -3205,29 +3446,24 @@ textarea.form-control-lg { flex-basis: auto; } .navbar-expand-xxl .navbar-toggler { display: none; } - .navbar-expand-xxl .offcanvas-header { - display: none; } .navbar-expand-xxl .offcanvas { - position: inherit; - bottom: 0; - z-index: 1000; + position: static; + z-index: auto; flex-grow: 1; + width: auto !important; + height: auto !important; visibility: visible !important; - background-color: transparent; - border-right: 0; - border-left: 0; - transition: none; - transform: none; } - .navbar-expand-xxl .offcanvas-top, - .navbar-expand-xxl .offcanvas-bottom { - height: auto; - border-top: 0; - border-bottom: 0; } - .navbar-expand-xxl .offcanvas-body { - display: flex; - flex-grow: 0; - padding: 0; - overflow-y: visible; } } + background-color: transparent !important; + border: 0 !important; + transform: none !important; + transition: none; } + .navbar-expand-xxl .offcanvas .offcanvas-header { + display: none; } + .navbar-expand-xxl .offcanvas .offcanvas-body { + display: flex; + flex-grow: 0; + padding: 0; + overflow-y: visible; } } .navbar-expand { flex-wrap: nowrap; @@ -3237,8 +3473,8 @@ textarea.form-control-lg { .navbar-expand .navbar-nav .dropdown-menu { position: absolute; } .navbar-expand .navbar-nav .nav-link { - padding-right: 0.5rem; - padding-left: 0.5rem; } + padding-right: var(--bs-navbar-nav-link-padding-x); + padding-left: var(--bs-navbar-nav-link-padding-x); } .navbar-expand .navbar-nav-scroll { overflow: visible; } .navbar-expand .navbar-collapse { @@ -3246,100 +3482,70 @@ textarea.form-control-lg { flex-basis: auto; } .navbar-expand .navbar-toggler { display: none; } - .navbar-expand .offcanvas-header { - display: none; } .navbar-expand .offcanvas { - position: inherit; - bottom: 0; - z-index: 1000; + position: static; + z-index: auto; flex-grow: 1; + width: auto !important; + height: auto !important; visibility: visible !important; - background-color: transparent; - border-right: 0; - border-left: 0; - transition: none; - transform: none; } - .navbar-expand .offcanvas-top, - .navbar-expand .offcanvas-bottom { - height: auto; - border-top: 0; - border-bottom: 0; } - .navbar-expand .offcanvas-body { - display: flex; - flex-grow: 0; - padding: 0; - overflow-y: visible; } + background-color: transparent !important; + border: 0 !important; + transform: none !important; + transition: none; } + .navbar-expand .offcanvas .offcanvas-header { + display: none; } + .navbar-expand .offcanvas .offcanvas-body { + display: flex; + flex-grow: 0; + padding: 0; + overflow-y: visible; } -.navbar-light .navbar-brand { - color: rgba(0, 0, 0, 0.9); } - .navbar-light .navbar-brand:hover, .navbar-light .navbar-brand:focus { - color: rgba(0, 0, 0, 0.9); } +.navbar-dark, +.navbar[data-bs-theme="dark"] { + --bs-navbar-color: rgba(255, 255, 255, 0.55); + --bs-navbar-hover-color: rgba(255, 255, 255, 0.75); + --bs-navbar-disabled-color: rgba(255, 255, 255, 0.25); + --bs-navbar-active-color: #fff; + --bs-navbar-brand-color: #fff; + --bs-navbar-brand-hover-color: #fff; + --bs-navbar-toggler-border-color: rgba(255, 255, 255, 0.1); + --bs-navbar-toggler-icon-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e"); } -.navbar-light .navbar-nav .nav-link { - color: rgba(0, 0, 0, 0.55); } - .navbar-light .navbar-nav .nav-link:hover, .navbar-light .navbar-nav .nav-link:focus { - color: rgba(0, 0, 0, 0.7); } - .navbar-light .navbar-nav .nav-link.disabled { - color: rgba(0, 0, 0, 0.3); } - -.navbar-light .navbar-nav .show > .nav-link, -.navbar-light .navbar-nav .nav-link.active { - color: rgba(0, 0, 0, 0.9); } - -.navbar-light .navbar-toggler { - color: rgba(0, 0, 0, 0.55); - border-color: rgba(0, 0, 0, 0.1); } - -.navbar-light .navbar-toggler-icon { - background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%280, 0, 0, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e"); } - -.navbar-light .navbar-text { - color: rgba(0, 0, 0, 0.55); } - .navbar-light .navbar-text a, - .navbar-light .navbar-text a:hover, - .navbar-light .navbar-text a:focus { - color: rgba(0, 0, 0, 0.9); } - -.navbar-dark .navbar-brand { - color: #fff; } - .navbar-dark .navbar-brand:hover, .navbar-dark .navbar-brand:focus { - color: #fff; } - -.navbar-dark .navbar-nav .nav-link { - color: rgba(255, 255, 255, 0.55); } - .navbar-dark .navbar-nav .nav-link:hover, .navbar-dark .navbar-nav .nav-link:focus { - color: rgba(255, 255, 255, 0.75); } - .navbar-dark .navbar-nav .nav-link.disabled { - color: rgba(255, 255, 255, 0.25); } - -.navbar-dark .navbar-nav .show > .nav-link, -.navbar-dark .navbar-nav .nav-link.active { - color: #fff; } - -.navbar-dark .navbar-toggler { - color: rgba(255, 255, 255, 0.55); - border-color: rgba(255, 255, 255, 0.1); } - -.navbar-dark .navbar-toggler-icon { - background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e"); } - -.navbar-dark .navbar-text { - color: rgba(255, 255, 255, 0.55); } - .navbar-dark .navbar-text a, - .navbar-dark .navbar-text a:hover, - .navbar-dark .navbar-text a:focus { - color: #fff; } +[data-bs-theme="dark"] .navbar-toggler-icon { + --bs-navbar-toggler-icon-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e"); } .card { + --bs-card-spacer-y: 1rem; + --bs-card-spacer-x: 1rem; + --bs-card-title-spacer-y: 0.5rem; + --bs-card-title-color: ; + --bs-card-subtitle-color: ; + --bs-card-border-width: var(--bs-border-width); + --bs-card-border-color: var(--bs-border-color-translucent); + --bs-card-border-radius: var(--bs-border-radius); + --bs-card-box-shadow: ; + --bs-card-inner-border-radius: calc(var(--bs-border-radius) - (var(--bs-border-width))); + --bs-card-cap-padding-y: 0.5rem; + --bs-card-cap-padding-x: 1rem; + --bs-card-cap-bg: rgba(var(--bs-body-color-rgb), 0.03); + --bs-card-cap-color: ; + --bs-card-height: ; + --bs-card-color: ; + --bs-card-bg: var(--bs-body-bg); + --bs-card-img-overlay-padding: 1rem; + --bs-card-group-margin: 0.75rem; position: relative; display: flex; flex-direction: column; min-width: 0; + height: var(--bs-card-height); + color: var(--bs-body-color); word-wrap: break-word; - background-color: #fff; + background-color: var(--bs-card-bg); background-clip: border-box; - border: 1px solid rgba(0, 0, 0, 0.125); - border-radius: 0.25rem; } + border: var(--bs-card-border-width) solid var(--bs-card-border-color); + border-radius: var(--bs-card-border-radius); } .card > hr { margin-right: 0; margin-left: 0; } @@ -3348,57 +3554,65 @@ textarea.form-control-lg { border-bottom: inherit; } .card > .list-group:first-child { border-top-width: 0; - border-top-left-radius: calc(0.25rem - 1px); - border-top-right-radius: calc(0.25rem - 1px); } + border-top-left-radius: var(--bs-card-inner-border-radius); + border-top-right-radius: var(--bs-card-inner-border-radius); } .card > .list-group:last-child { border-bottom-width: 0; - border-bottom-right-radius: calc(0.25rem - 1px); - border-bottom-left-radius: calc(0.25rem - 1px); } + border-bottom-right-radius: var(--bs-card-inner-border-radius); + border-bottom-left-radius: var(--bs-card-inner-border-radius); } .card > .card-header + .list-group, .card > .list-group + .card-footer { border-top: 0; } .card-body { flex: 1 1 auto; - padding: 1rem 1rem; } + padding: var(--bs-card-spacer-y) var(--bs-card-spacer-x); + color: var(--bs-card-color); } .card-title { - margin-bottom: 0.5rem; } + margin-bottom: var(--bs-card-title-spacer-y); + color: var(--bs-card-title-color); } .card-subtitle { - margin-top: -0.25rem; - margin-bottom: 0; } + margin-top: calc(-.5 * var(--bs-card-title-spacer-y)); + margin-bottom: 0; + color: var(--bs-card-subtitle-color); } .card-text:last-child { margin-bottom: 0; } .card-link + .card-link { - margin-left: 1rem; } + margin-left: var(--bs-card-spacer-x); } .card-header { - padding: 0.5rem 1rem; + padding: var(--bs-card-cap-padding-y) var(--bs-card-cap-padding-x); margin-bottom: 0; - background-color: rgba(0, 0, 0, 0.03); - border-bottom: 1px solid rgba(0, 0, 0, 0.125); } + color: var(--bs-card-cap-color); + background-color: var(--bs-card-cap-bg); + border-bottom: var(--bs-card-border-width) solid var(--bs-card-border-color); } .card-header:first-child { - border-radius: calc(0.25rem - 1px) calc(0.25rem - 1px) 0 0; } + border-radius: var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius) 0 0; } .card-footer { - padding: 0.5rem 1rem; - background-color: rgba(0, 0, 0, 0.03); - border-top: 1px solid rgba(0, 0, 0, 0.125); } + padding: var(--bs-card-cap-padding-y) var(--bs-card-cap-padding-x); + color: var(--bs-card-cap-color); + background-color: var(--bs-card-cap-bg); + border-top: var(--bs-card-border-width) solid var(--bs-card-border-color); } .card-footer:last-child { - border-radius: 0 0 calc(0.25rem - 1px) calc(0.25rem - 1px); } + border-radius: 0 0 var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius); } .card-header-tabs { - margin-right: -0.5rem; - margin-bottom: -0.5rem; - margin-left: -0.5rem; + margin-right: calc(-.5 * var(--bs-card-cap-padding-x)); + margin-bottom: calc(-1 * var(--bs-card-cap-padding-y)); + margin-left: calc(-.5 * var(--bs-card-cap-padding-x)); border-bottom: 0; } + .card-header-tabs .nav-link.active { + background-color: var(--bs-card-bg); + border-bottom-color: var(--bs-card-bg); } .card-header-pills { - margin-right: -0.5rem; - margin-left: -0.5rem; } + margin-right: calc(-.5 * var(--bs-card-cap-padding-x)); + margin-left: calc(-.5 * var(--bs-card-cap-padding-x)); } .card-img-overlay { position: absolute; @@ -3406,8 +3620,8 @@ textarea.form-control-lg { right: 0; bottom: 0; left: 0; - padding: 1rem; - border-radius: calc(0.25rem - 1px); } + padding: var(--bs-card-img-overlay-padding); + border-radius: var(--bs-card-inner-border-radius); } .card-img, .card-img-top, @@ -3416,16 +3630,16 @@ textarea.form-control-lg { .card-img, .card-img-top { - border-top-left-radius: calc(0.25rem - 1px); - border-top-right-radius: calc(0.25rem - 1px); } + border-top-left-radius: var(--bs-card-inner-border-radius); + border-top-right-radius: var(--bs-card-inner-border-radius); } .card-img, .card-img-bottom { - border-bottom-right-radius: calc(0.25rem - 1px); - border-bottom-left-radius: calc(0.25rem - 1px); } + border-bottom-right-radius: var(--bs-card-inner-border-radius); + border-bottom-left-radius: var(--bs-card-inner-border-radius); } .card-group > .card { - margin-bottom: 0.75rem; } + margin-bottom: var(--bs-card-group-margin); } @media (min-width: 576px) { .card-group { @@ -3456,40 +3670,63 @@ textarea.form-control-lg { .card-group > .card:not(:first-child) .card-footer { border-bottom-left-radius: 0; } } +.accordion { + --bs-accordion-color: var(--bs-body-color); + --bs-accordion-bg: var(--bs-body-bg); + --bs-accordion-transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, border-radius 0.15s ease; + --bs-accordion-border-color: var(--bs-border-color); + --bs-accordion-border-width: var(--bs-border-width); + --bs-accordion-border-radius: var(--bs-border-radius); + --bs-accordion-inner-border-radius: calc(var(--bs-border-radius) - (var(--bs-border-width))); + --bs-accordion-btn-padding-x: 1.25rem; + --bs-accordion-btn-padding-y: 1rem; + --bs-accordion-btn-color: var(--bs-body-color); + --bs-accordion-btn-bg: var(--bs-accordion-bg); + --bs-accordion-btn-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23212529' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M2 5L8 11L14 5'/%3e%3c/svg%3e"); + --bs-accordion-btn-icon-width: 1.25rem; + --bs-accordion-btn-icon-transform: rotate(-180deg); + --bs-accordion-btn-icon-transition: transform 0.2s ease-in-out; + --bs-accordion-btn-active-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23052c65' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M2 5L8 11L14 5'/%3e%3c/svg%3e"); + --bs-accordion-btn-focus-box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25); + --bs-accordion-body-padding-x: 1.25rem; + --bs-accordion-body-padding-y: 1rem; + --bs-accordion-active-color: var(--bs-primary-text-emphasis); + --bs-accordion-active-bg: var(--bs-primary-bg-subtle); } + .accordion-button { position: relative; display: flex; align-items: center; width: 100%; - padding: 1rem 1.25rem; + padding: var(--bs-accordion-btn-padding-y) var(--bs-accordion-btn-padding-x); font-size: 1rem; - color: #212529; + color: var(--bs-accordion-btn-color); text-align: left; - background-color: #fff; + background-color: var(--bs-accordion-btn-bg); border: 0; border-radius: 0; overflow-anchor: none; - transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, border-radius 0.15s ease; } + transition: var(--bs-accordion-transition); } @media (prefers-reduced-motion: reduce) { .accordion-button { transition: none; } } .accordion-button:not(.collapsed) { - color: #0c63e4; - background-color: #e7f1ff; - box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.125); } + color: var(--bs-accordion-active-color); + background-color: var(--bs-accordion-active-bg); + box-shadow: inset 0 calc(-1 * var(--bs-accordion-border-width)) 0 var(--bs-accordion-border-color); } .accordion-button:not(.collapsed)::after { - background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%230c63e4'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e"); - transform: rotate(-180deg); } + background-image: var(--bs-accordion-btn-active-icon); + transform: var(--bs-accordion-btn-icon-transform); } .accordion-button::after { flex-shrink: 0; - width: 1.25rem; - height: 1.25rem; + width: var(--bs-accordion-btn-icon-width); + height: var(--bs-accordion-btn-icon-width); margin-left: auto; content: ""; - background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23212529'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e"); + background-image: var(--bs-accordion-btn-icon); background-repeat: no-repeat; - background-size: 1.25rem; - transition: transform 0.2s ease-in-out; } + background-size: var(--bs-accordion-btn-icon-width); + transition: var(--bs-accordion-btn-icon-transition); } @media (prefers-reduced-motion: reduce) { .accordion-button::after { transition: none; } } @@ -3497,70 +3734,104 @@ textarea.form-control-lg { z-index: 2; } .accordion-button:focus { z-index: 3; - border-color: #86b7fe; outline: 0; - box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25); } + box-shadow: var(--bs-accordion-btn-focus-box-shadow); } .accordion-header { margin-bottom: 0; } .accordion-item { - background-color: #fff; - border: 1px solid rgba(0, 0, 0, 0.125); } + color: var(--bs-accordion-color); + background-color: var(--bs-accordion-bg); + border: var(--bs-accordion-border-width) solid var(--bs-accordion-border-color); } .accordion-item:first-of-type { - border-top-left-radius: 0.25rem; - border-top-right-radius: 0.25rem; } - .accordion-item:first-of-type .accordion-button { - border-top-left-radius: calc(0.25rem - 1px); - border-top-right-radius: calc(0.25rem - 1px); } + border-top-left-radius: var(--bs-accordion-border-radius); + border-top-right-radius: var(--bs-accordion-border-radius); } + .accordion-item:first-of-type > .accordion-header .accordion-button { + border-top-left-radius: var(--bs-accordion-inner-border-radius); + border-top-right-radius: var(--bs-accordion-inner-border-radius); } .accordion-item:not(:first-of-type) { border-top: 0; } .accordion-item:last-of-type { - border-bottom-right-radius: 0.25rem; - border-bottom-left-radius: 0.25rem; } - .accordion-item:last-of-type .accordion-button.collapsed { - border-bottom-right-radius: calc(0.25rem - 1px); - border-bottom-left-radius: calc(0.25rem - 1px); } - .accordion-item:last-of-type .accordion-collapse { - border-bottom-right-radius: 0.25rem; - border-bottom-left-radius: 0.25rem; } + border-bottom-right-radius: var(--bs-accordion-border-radius); + border-bottom-left-radius: var(--bs-accordion-border-radius); } + .accordion-item:last-of-type > .accordion-header .accordion-button.collapsed { + border-bottom-right-radius: var(--bs-accordion-inner-border-radius); + border-bottom-left-radius: var(--bs-accordion-inner-border-radius); } + .accordion-item:last-of-type > .accordion-collapse { + border-bottom-right-radius: var(--bs-accordion-border-radius); + border-bottom-left-radius: var(--bs-accordion-border-radius); } .accordion-body { - padding: 1rem 1.25rem; } + padding: var(--bs-accordion-body-padding-y) var(--bs-accordion-body-padding-x); } -.accordion-flush .accordion-collapse { - border-width: 0; } - -.accordion-flush .accordion-item { +.accordion-flush > .accordion-item { border-right: 0; border-left: 0; border-radius: 0; } - .accordion-flush .accordion-item:first-child { + .accordion-flush > .accordion-item:first-child { border-top: 0; } - .accordion-flush .accordion-item:last-child { + .accordion-flush > .accordion-item:last-child { border-bottom: 0; } - .accordion-flush .accordion-item .accordion-button { + .accordion-flush > .accordion-item > .accordion-header .accordion-button, .accordion-flush > .accordion-item > .accordion-header .accordion-button.collapsed { + border-radius: 0; } + .accordion-flush > .accordion-item > .accordion-collapse { border-radius: 0; } +[data-bs-theme="dark"] .accordion-button::after { + --bs-accordion-btn-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%236ea8fe'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e"); + --bs-accordion-btn-active-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%236ea8fe'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e"); } + .breadcrumb { + --bs-breadcrumb-padding-x: 0; + --bs-breadcrumb-padding-y: 0; + --bs-breadcrumb-margin-bottom: 1rem; + --bs-breadcrumb-bg: ; + --bs-breadcrumb-border-radius: ; + --bs-breadcrumb-divider-color: var(--bs-secondary-color); + --bs-breadcrumb-item-padding-x: 0.5rem; + --bs-breadcrumb-item-active-color: var(--bs-secondary-color); display: flex; flex-wrap: wrap; - padding: 0 0; - margin-bottom: 1rem; - list-style: none; } + padding: var(--bs-breadcrumb-padding-y) var(--bs-breadcrumb-padding-x); + margin-bottom: var(--bs-breadcrumb-margin-bottom); + font-size: var(--bs-breadcrumb-font-size); + list-style: none; + background-color: var(--bs-breadcrumb-bg); + border-radius: var(--bs-breadcrumb-border-radius); } .breadcrumb-item + .breadcrumb-item { - padding-left: 0.5rem; } + padding-left: var(--bs-breadcrumb-item-padding-x); } .breadcrumb-item + .breadcrumb-item::before { float: left; - padding-right: 0.5rem; - color: #6c757d; + padding-right: var(--bs-breadcrumb-item-padding-x); + color: var(--bs-breadcrumb-divider-color); content: var(--bs-breadcrumb-divider, "/") /* rtl: var(--bs-breadcrumb-divider, "/") */; } .breadcrumb-item.active { - color: #6c757d; } + color: var(--bs-breadcrumb-item-active-color); } .pagination { + --bs-pagination-padding-x: 0.75rem; + --bs-pagination-padding-y: 0.375rem; + --bs-pagination-font-size: 1rem; + --bs-pagination-color: var(--bs-link-color); + --bs-pagination-bg: var(--bs-body-bg); + --bs-pagination-border-width: var(--bs-border-width); + --bs-pagination-border-color: var(--bs-border-color); + --bs-pagination-border-radius: var(--bs-border-radius); + --bs-pagination-hover-color: var(--bs-link-hover-color); + --bs-pagination-hover-bg: var(--bs-tertiary-bg); + --bs-pagination-hover-border-color: var(--bs-border-color); + --bs-pagination-focus-color: var(--bs-link-hover-color); + --bs-pagination-focus-bg: var(--bs-secondary-bg); + --bs-pagination-focus-box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25); + --bs-pagination-active-color: #fff; + --bs-pagination-active-bg: #0d6efd; + --bs-pagination-active-border-color: #0d6efd; + --bs-pagination-disabled-color: var(--bs-secondary-color); + --bs-pagination-disabled-bg: var(--bs-secondary-bg); + --bs-pagination-disabled-border-color: var(--bs-border-color); display: flex; padding-left: 0; list-style: none; } @@ -3568,87 +3839,78 @@ textarea.form-control-lg { .page-link { position: relative; display: block; - color: #0d6efd; + padding: var(--bs-pagination-padding-y) var(--bs-pagination-padding-x); + font-size: var(--bs-pagination-font-size); + color: var(--bs-pagination-color); text-decoration: none; - background-color: #fff; - border: 1px solid #dee2e6; + background-color: var(--bs-pagination-bg); + border: var(--bs-pagination-border-width) solid var(--bs-pagination-border-color); transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; } @media (prefers-reduced-motion: reduce) { .page-link { transition: none; } } .page-link:hover { z-index: 2; - color: #0a58ca; - background-color: #e9ecef; - border-color: #dee2e6; } + color: var(--bs-pagination-hover-color); + background-color: var(--bs-pagination-hover-bg); + border-color: var(--bs-pagination-hover-border-color); } .page-link:focus { z-index: 3; - color: #0a58ca; - background-color: #e9ecef; + color: var(--bs-pagination-focus-color); + background-color: var(--bs-pagination-focus-bg); outline: 0; - box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25); } + box-shadow: var(--bs-pagination-focus-box-shadow); } + .page-link.active, .active > .page-link { + z-index: 3; + color: var(--bs-pagination-active-color); + background-color: var(--bs-pagination-active-bg); + border-color: var(--bs-pagination-active-border-color); } + .page-link.disabled, .disabled > .page-link { + color: var(--bs-pagination-disabled-color); + pointer-events: none; + background-color: var(--bs-pagination-disabled-bg); + border-color: var(--bs-pagination-disabled-border-color); } .page-item:not(:first-child) .page-link { - margin-left: -1px; } - -.page-item.active .page-link { - z-index: 3; - color: #fff; - background-color: #0d6efd; - border-color: #0d6efd; } - -.page-item.disabled .page-link { - color: #6c757d; - pointer-events: none; - background-color: #fff; - border-color: #dee2e6; } - -.page-link { - padding: 0.375rem 0.75rem; } + margin-left: calc(var(--bs-border-width) * -1); } .page-item:first-child .page-link { - border-top-left-radius: 0.25rem; - border-bottom-left-radius: 0.25rem; } + border-top-left-radius: var(--bs-pagination-border-radius); + border-bottom-left-radius: var(--bs-pagination-border-radius); } .page-item:last-child .page-link { - border-top-right-radius: 0.25rem; - border-bottom-right-radius: 0.25rem; } + border-top-right-radius: var(--bs-pagination-border-radius); + border-bottom-right-radius: var(--bs-pagination-border-radius); } -.pagination-lg .page-link { - padding: 0.75rem 1.5rem; - font-size: 1.25rem; } +.pagination-lg { + --bs-pagination-padding-x: 1.5rem; + --bs-pagination-padding-y: 0.75rem; + --bs-pagination-font-size: 1.25rem; + --bs-pagination-border-radius: var(--bs-border-radius-lg); } -.pagination-lg .page-item:first-child .page-link { - border-top-left-radius: 0.3rem; - border-bottom-left-radius: 0.3rem; } - -.pagination-lg .page-item:last-child .page-link { - border-top-right-radius: 0.3rem; - border-bottom-right-radius: 0.3rem; } - -.pagination-sm .page-link { - padding: 0.25rem 0.5rem; - font-size: 0.875rem; } - -.pagination-sm .page-item:first-child .page-link { - border-top-left-radius: 0.2rem; - border-bottom-left-radius: 0.2rem; } - -.pagination-sm .page-item:last-child .page-link { - border-top-right-radius: 0.2rem; - border-bottom-right-radius: 0.2rem; } +.pagination-sm { + --bs-pagination-padding-x: 0.5rem; + --bs-pagination-padding-y: 0.25rem; + --bs-pagination-font-size: 0.875rem; + --bs-pagination-border-radius: var(--bs-border-radius-sm); } .badge { + --bs-badge-padding-x: 0.65em; + --bs-badge-padding-y: 0.35em; + --bs-badge-font-size: 0.75em; + --bs-badge-font-weight: 700; + --bs-badge-color: #fff; + --bs-badge-border-radius: var(--bs-border-radius); display: inline-block; - padding: 0.35em 0.65em; - font-size: 0.75em; - font-weight: 700; + padding: var(--bs-badge-padding-y) var(--bs-badge-padding-x); + font-size: var(--bs-badge-font-size); + font-weight: var(--bs-badge-font-weight); line-height: 1; - color: #fff; + color: var(--bs-badge-color); text-align: center; white-space: nowrap; vertical-align: baseline; - border-radius: 0.25rem; } + border-radius: var(--bs-badge-border-radius); } .badge:empty { display: none; } @@ -3657,17 +3919,29 @@ textarea.form-control-lg { top: -1px; } .alert { + --bs-alert-bg: transparent; + --bs-alert-padding-x: 1rem; + --bs-alert-padding-y: 1rem; + --bs-alert-margin-bottom: 1rem; + --bs-alert-color: inherit; + --bs-alert-border-color: transparent; + --bs-alert-border: var(--bs-border-width) solid var(--bs-alert-border-color); + --bs-alert-border-radius: var(--bs-border-radius); + --bs-alert-link-color: inherit; position: relative; - padding: 1rem 1rem; - margin-bottom: 1rem; - border: 1px solid transparent; - border-radius: 0.25rem; } + padding: var(--bs-alert-padding-y) var(--bs-alert-padding-x); + margin-bottom: var(--bs-alert-margin-bottom); + color: var(--bs-alert-color); + background-color: var(--bs-alert-bg); + border: var(--bs-alert-border); + border-radius: var(--bs-alert-border-radius); } .alert-heading { color: inherit; } .alert-link { - font-weight: 700; } + font-weight: 700; + color: var(--bs-alert-link-color); } .alert-dismissible { padding-right: 3rem; } @@ -3679,89 +3953,96 @@ textarea.form-control-lg { padding: 1.25rem 1rem; } .alert-primary { - color: #084298; - background-color: #cfe2ff; - border-color: #b6d4fe; } - .alert-primary .alert-link { - color: #06357a; } + --bs-alert-color: var(--bs-primary-text-emphasis); + --bs-alert-bg: var(--bs-primary-bg-subtle); + --bs-alert-border-color: var(--bs-primary-border-subtle); + --bs-alert-link-color: var(--bs-primary-text-emphasis); } .alert-secondary { - color: #41464b; - background-color: #e2e3e5; - border-color: #d3d6d8; } - .alert-secondary .alert-link { - color: #34383c; } + --bs-alert-color: var(--bs-secondary-text-emphasis); + --bs-alert-bg: var(--bs-secondary-bg-subtle); + --bs-alert-border-color: var(--bs-secondary-border-subtle); + --bs-alert-link-color: var(--bs-secondary-text-emphasis); } .alert-success { - color: #0f5132; - background-color: #d1e7dd; - border-color: #badbcc; } - .alert-success .alert-link { - color: #0c4128; } + --bs-alert-color: var(--bs-success-text-emphasis); + --bs-alert-bg: var(--bs-success-bg-subtle); + --bs-alert-border-color: var(--bs-success-border-subtle); + --bs-alert-link-color: var(--bs-success-text-emphasis); } .alert-info { - color: #055160; - background-color: #cff4fc; - border-color: #b6effb; } - .alert-info .alert-link { - color: #04414d; } + --bs-alert-color: var(--bs-info-text-emphasis); + --bs-alert-bg: var(--bs-info-bg-subtle); + --bs-alert-border-color: var(--bs-info-border-subtle); + --bs-alert-link-color: var(--bs-info-text-emphasis); } .alert-warning { - color: #664d03; - background-color: #fff3cd; - border-color: #ffecb5; } - .alert-warning .alert-link { - color: #523e02; } + --bs-alert-color: var(--bs-warning-text-emphasis); + --bs-alert-bg: var(--bs-warning-bg-subtle); + --bs-alert-border-color: var(--bs-warning-border-subtle); + --bs-alert-link-color: var(--bs-warning-text-emphasis); } .alert-danger { - color: #842029; - background-color: #f8d7da; - border-color: #f5c2c7; } - .alert-danger .alert-link { - color: #6a1a21; } + --bs-alert-color: var(--bs-danger-text-emphasis); + --bs-alert-bg: var(--bs-danger-bg-subtle); + --bs-alert-border-color: var(--bs-danger-border-subtle); + --bs-alert-link-color: var(--bs-danger-text-emphasis); } .alert-light { - color: #636464; - background-color: #fefefe; - border-color: #fdfdfe; } - .alert-light .alert-link { - color: #4f5050; } + --bs-alert-color: var(--bs-light-text-emphasis); + --bs-alert-bg: var(--bs-light-bg-subtle); + --bs-alert-border-color: var(--bs-light-border-subtle); + --bs-alert-link-color: var(--bs-light-text-emphasis); } .alert-dark { - color: #141619; - background-color: #d3d3d4; - border-color: #bcbebf; } - .alert-dark .alert-link { - color: #101214; } + --bs-alert-color: var(--bs-dark-text-emphasis); + --bs-alert-bg: var(--bs-dark-bg-subtle); + --bs-alert-border-color: var(--bs-dark-border-subtle); + --bs-alert-link-color: var(--bs-dark-text-emphasis); } @keyframes progress-bar-stripes { 0% { background-position-x: 1rem; } } -.progress { +.progress, +.progress-stacked { + --bs-progress-height: 1rem; + --bs-progress-font-size: 0.75rem; + --bs-progress-bg: var(--bs-secondary-bg); + --bs-progress-border-radius: var(--bs-border-radius); + --bs-progress-box-shadow: var(--bs-box-shadow-inset); + --bs-progress-bar-color: #fff; + --bs-progress-bar-bg: #0d6efd; + --bs-progress-bar-transition: width 0.6s ease; display: flex; - height: 1rem; + height: var(--bs-progress-height); overflow: hidden; - font-size: 0.75rem; - background-color: #e9ecef; - border-radius: 0.25rem; } + font-size: var(--bs-progress-font-size); + background-color: var(--bs-progress-bg); + border-radius: var(--bs-progress-border-radius); } .progress-bar { display: flex; flex-direction: column; justify-content: center; overflow: hidden; - color: #fff; + color: var(--bs-progress-bar-color); text-align: center; white-space: nowrap; - background-color: #0d6efd; - transition: width 0.6s ease; } + background-color: var(--bs-progress-bar-bg); + transition: var(--bs-progress-bar-transition); } @media (prefers-reduced-motion: reduce) { .progress-bar { transition: none; } } .progress-bar-striped { background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent); - background-size: 1rem 1rem; } + background-size: var(--bs-progress-height) var(--bs-progress-height); } + +.progress-stacked > .progress { + overflow: visible; } + +.progress-stacked > .progress > .progress-bar { + width: 100%; } .progress-bar-animated { animation: 1s linear infinite progress-bar-stripes; } @@ -3769,40 +4050,57 @@ textarea.form-control-lg { .progress-bar-animated { animation: none; } } .list-group { + --bs-list-group-color: var(--bs-body-color); + --bs-list-group-bg: var(--bs-body-bg); + --bs-list-group-border-color: var(--bs-border-color); + --bs-list-group-border-width: var(--bs-border-width); + --bs-list-group-border-radius: var(--bs-border-radius); + --bs-list-group-item-padding-x: 1rem; + --bs-list-group-item-padding-y: 0.5rem; + --bs-list-group-action-color: var(--bs-secondary-color); + --bs-list-group-action-hover-color: var(--bs-emphasis-color); + --bs-list-group-action-hover-bg: var(--bs-tertiary-bg); + --bs-list-group-action-active-color: var(--bs-body-color); + --bs-list-group-action-active-bg: var(--bs-secondary-bg); + --bs-list-group-disabled-color: var(--bs-secondary-color); + --bs-list-group-disabled-bg: var(--bs-body-bg); + --bs-list-group-active-color: #fff; + --bs-list-group-active-bg: #0d6efd; + --bs-list-group-active-border-color: #0d6efd; display: flex; flex-direction: column; padding-left: 0; margin-bottom: 0; - border-radius: 0.25rem; } + border-radius: var(--bs-list-group-border-radius); } .list-group-numbered { list-style-type: none; counter-reset: section; } - .list-group-numbered > li::before { + .list-group-numbered > .list-group-item::before { content: counters(section, ".") ". "; counter-increment: section; } .list-group-item-action { width: 100%; - color: #495057; + color: var(--bs-list-group-action-color); text-align: inherit; } .list-group-item-action:hover, .list-group-item-action:focus { z-index: 1; - color: #495057; + color: var(--bs-list-group-action-hover-color); text-decoration: none; - background-color: #f8f9fa; } + background-color: var(--bs-list-group-action-hover-bg); } .list-group-item-action:active { - color: #212529; - background-color: #e9ecef; } + color: var(--bs-list-group-action-active-color); + background-color: var(--bs-list-group-action-active-bg); } .list-group-item { position: relative; display: block; - padding: 0.5rem 1rem; - color: #212529; + padding: var(--bs-list-group-item-padding-y) var(--bs-list-group-item-padding-x); + color: var(--bs-list-group-color); text-decoration: none; - background-color: #fff; - border: 1px solid rgba(0, 0, 0, 0.125); } + background-color: var(--bs-list-group-bg); + border: var(--bs-list-group-border-width) solid var(--bs-list-group-border-color); } .list-group-item:first-child { border-top-left-radius: inherit; border-top-right-radius: inherit; } @@ -3810,293 +4108,352 @@ textarea.form-control-lg { border-bottom-right-radius: inherit; border-bottom-left-radius: inherit; } .list-group-item.disabled, .list-group-item:disabled { - color: #6c757d; + color: var(--bs-list-group-disabled-color); pointer-events: none; - background-color: #fff; } + background-color: var(--bs-list-group-disabled-bg); } .list-group-item.active { z-index: 2; - color: #fff; - background-color: #0d6efd; - border-color: #0d6efd; } + color: var(--bs-list-group-active-color); + background-color: var(--bs-list-group-active-bg); + border-color: var(--bs-list-group-active-border-color); } .list-group-item + .list-group-item { border-top-width: 0; } .list-group-item + .list-group-item.active { - margin-top: -1px; - border-top-width: 1px; } + margin-top: calc(-1 * var(--bs-list-group-border-width)); + border-top-width: var(--bs-list-group-border-width); } .list-group-horizontal { flex-direction: row; } - .list-group-horizontal > .list-group-item:first-child { - border-bottom-left-radius: 0.25rem; + .list-group-horizontal > .list-group-item:first-child:not(:last-child) { + border-bottom-left-radius: var(--bs-list-group-border-radius); border-top-right-radius: 0; } - .list-group-horizontal > .list-group-item:last-child { - border-top-right-radius: 0.25rem; + .list-group-horizontal > .list-group-item:last-child:not(:first-child) { + border-top-right-radius: var(--bs-list-group-border-radius); border-bottom-left-radius: 0; } .list-group-horizontal > .list-group-item.active { margin-top: 0; } .list-group-horizontal > .list-group-item + .list-group-item { - border-top-width: 1px; + border-top-width: var(--bs-list-group-border-width); border-left-width: 0; } .list-group-horizontal > .list-group-item + .list-group-item.active { - margin-left: -1px; - border-left-width: 1px; } + margin-left: calc(-1 * var(--bs-list-group-border-width)); + border-left-width: var(--bs-list-group-border-width); } @media (min-width: 576px) { .list-group-horizontal-sm { flex-direction: row; } - .list-group-horizontal-sm > .list-group-item:first-child { - border-bottom-left-radius: 0.25rem; + .list-group-horizontal-sm > .list-group-item:first-child:not(:last-child) { + border-bottom-left-radius: var(--bs-list-group-border-radius); border-top-right-radius: 0; } - .list-group-horizontal-sm > .list-group-item:last-child { - border-top-right-radius: 0.25rem; + .list-group-horizontal-sm > .list-group-item:last-child:not(:first-child) { + border-top-right-radius: var(--bs-list-group-border-radius); border-bottom-left-radius: 0; } .list-group-horizontal-sm > .list-group-item.active { margin-top: 0; } .list-group-horizontal-sm > .list-group-item + .list-group-item { - border-top-width: 1px; + border-top-width: var(--bs-list-group-border-width); border-left-width: 0; } .list-group-horizontal-sm > .list-group-item + .list-group-item.active { - margin-left: -1px; - border-left-width: 1px; } } + margin-left: calc(-1 * var(--bs-list-group-border-width)); + border-left-width: var(--bs-list-group-border-width); } } @media (min-width: 768px) { .list-group-horizontal-md { flex-direction: row; } - .list-group-horizontal-md > .list-group-item:first-child { - border-bottom-left-radius: 0.25rem; + .list-group-horizontal-md > .list-group-item:first-child:not(:last-child) { + border-bottom-left-radius: var(--bs-list-group-border-radius); border-top-right-radius: 0; } - .list-group-horizontal-md > .list-group-item:last-child { - border-top-right-radius: 0.25rem; + .list-group-horizontal-md > .list-group-item:last-child:not(:first-child) { + border-top-right-radius: var(--bs-list-group-border-radius); border-bottom-left-radius: 0; } .list-group-horizontal-md > .list-group-item.active { margin-top: 0; } .list-group-horizontal-md > .list-group-item + .list-group-item { - border-top-width: 1px; + border-top-width: var(--bs-list-group-border-width); border-left-width: 0; } .list-group-horizontal-md > .list-group-item + .list-group-item.active { - margin-left: -1px; - border-left-width: 1px; } } + margin-left: calc(-1 * var(--bs-list-group-border-width)); + border-left-width: var(--bs-list-group-border-width); } } @media (min-width: 992px) { .list-group-horizontal-lg { flex-direction: row; } - .list-group-horizontal-lg > .list-group-item:first-child { - border-bottom-left-radius: 0.25rem; + .list-group-horizontal-lg > .list-group-item:first-child:not(:last-child) { + border-bottom-left-radius: var(--bs-list-group-border-radius); border-top-right-radius: 0; } - .list-group-horizontal-lg > .list-group-item:last-child { - border-top-right-radius: 0.25rem; + .list-group-horizontal-lg > .list-group-item:last-child:not(:first-child) { + border-top-right-radius: var(--bs-list-group-border-radius); border-bottom-left-radius: 0; } .list-group-horizontal-lg > .list-group-item.active { margin-top: 0; } .list-group-horizontal-lg > .list-group-item + .list-group-item { - border-top-width: 1px; + border-top-width: var(--bs-list-group-border-width); border-left-width: 0; } .list-group-horizontal-lg > .list-group-item + .list-group-item.active { - margin-left: -1px; - border-left-width: 1px; } } + margin-left: calc(-1 * var(--bs-list-group-border-width)); + border-left-width: var(--bs-list-group-border-width); } } @media (min-width: 1200px) { .list-group-horizontal-xl { flex-direction: row; } - .list-group-horizontal-xl > .list-group-item:first-child { - border-bottom-left-radius: 0.25rem; + .list-group-horizontal-xl > .list-group-item:first-child:not(:last-child) { + border-bottom-left-radius: var(--bs-list-group-border-radius); border-top-right-radius: 0; } - .list-group-horizontal-xl > .list-group-item:last-child { - border-top-right-radius: 0.25rem; + .list-group-horizontal-xl > .list-group-item:last-child:not(:first-child) { + border-top-right-radius: var(--bs-list-group-border-radius); border-bottom-left-radius: 0; } .list-group-horizontal-xl > .list-group-item.active { margin-top: 0; } .list-group-horizontal-xl > .list-group-item + .list-group-item { - border-top-width: 1px; + border-top-width: var(--bs-list-group-border-width); border-left-width: 0; } .list-group-horizontal-xl > .list-group-item + .list-group-item.active { - margin-left: -1px; - border-left-width: 1px; } } + margin-left: calc(-1 * var(--bs-list-group-border-width)); + border-left-width: var(--bs-list-group-border-width); } } @media (min-width: 1400px) { .list-group-horizontal-xxl { flex-direction: row; } - .list-group-horizontal-xxl > .list-group-item:first-child { - border-bottom-left-radius: 0.25rem; + .list-group-horizontal-xxl > .list-group-item:first-child:not(:last-child) { + border-bottom-left-radius: var(--bs-list-group-border-radius); border-top-right-radius: 0; } - .list-group-horizontal-xxl > .list-group-item:last-child { - border-top-right-radius: 0.25rem; + .list-group-horizontal-xxl > .list-group-item:last-child:not(:first-child) { + border-top-right-radius: var(--bs-list-group-border-radius); border-bottom-left-radius: 0; } .list-group-horizontal-xxl > .list-group-item.active { margin-top: 0; } .list-group-horizontal-xxl > .list-group-item + .list-group-item { - border-top-width: 1px; + border-top-width: var(--bs-list-group-border-width); border-left-width: 0; } .list-group-horizontal-xxl > .list-group-item + .list-group-item.active { - margin-left: -1px; - border-left-width: 1px; } } + margin-left: calc(-1 * var(--bs-list-group-border-width)); + border-left-width: var(--bs-list-group-border-width); } } .list-group-flush { border-radius: 0; } .list-group-flush > .list-group-item { - border-width: 0 0 1px; } + border-width: 0 0 var(--bs-list-group-border-width); } .list-group-flush > .list-group-item:last-child { border-bottom-width: 0; } .list-group-item-primary { - color: #084298; - background-color: #cfe2ff; } - .list-group-item-primary.list-group-item-action:hover, .list-group-item-primary.list-group-item-action:focus { - color: #084298; - background-color: #bacbe6; } - .list-group-item-primary.list-group-item-action.active { - color: #fff; - background-color: #084298; - border-color: #084298; } + --bs-list-group-color: var(--bs-primary-text-emphasis); + --bs-list-group-bg: var(--bs-primary-bg-subtle); + --bs-list-group-border-color: var(--bs-primary-border-subtle); + --bs-list-group-action-hover-color: var(--bs-emphasis-color); + --bs-list-group-action-hover-bg: var(--bs-primary-border-subtle); + --bs-list-group-action-active-color: var(--bs-emphasis-color); + --bs-list-group-action-active-bg: var(--bs-primary-border-subtle); + --bs-list-group-active-color: var(--bs-primary-bg-subtle); + --bs-list-group-active-bg: var(--bs-primary-text-emphasis); + --bs-list-group-active-border-color: var(--bs-primary-text-emphasis); } .list-group-item-secondary { - color: #41464b; - background-color: #e2e3e5; } - .list-group-item-secondary.list-group-item-action:hover, .list-group-item-secondary.list-group-item-action:focus { - color: #41464b; - background-color: #cbccce; } - .list-group-item-secondary.list-group-item-action.active { - color: #fff; - background-color: #41464b; - border-color: #41464b; } + --bs-list-group-color: var(--bs-secondary-text-emphasis); + --bs-list-group-bg: var(--bs-secondary-bg-subtle); + --bs-list-group-border-color: var(--bs-secondary-border-subtle); + --bs-list-group-action-hover-color: var(--bs-emphasis-color); + --bs-list-group-action-hover-bg: var(--bs-secondary-border-subtle); + --bs-list-group-action-active-color: var(--bs-emphasis-color); + --bs-list-group-action-active-bg: var(--bs-secondary-border-subtle); + --bs-list-group-active-color: var(--bs-secondary-bg-subtle); + --bs-list-group-active-bg: var(--bs-secondary-text-emphasis); + --bs-list-group-active-border-color: var(--bs-secondary-text-emphasis); } .list-group-item-success { - color: #0f5132; - background-color: #d1e7dd; } - .list-group-item-success.list-group-item-action:hover, .list-group-item-success.list-group-item-action:focus { - color: #0f5132; - background-color: #bcd0c7; } - .list-group-item-success.list-group-item-action.active { - color: #fff; - background-color: #0f5132; - border-color: #0f5132; } + --bs-list-group-color: var(--bs-success-text-emphasis); + --bs-list-group-bg: var(--bs-success-bg-subtle); + --bs-list-group-border-color: var(--bs-success-border-subtle); + --bs-list-group-action-hover-color: var(--bs-emphasis-color); + --bs-list-group-action-hover-bg: var(--bs-success-border-subtle); + --bs-list-group-action-active-color: var(--bs-emphasis-color); + --bs-list-group-action-active-bg: var(--bs-success-border-subtle); + --bs-list-group-active-color: var(--bs-success-bg-subtle); + --bs-list-group-active-bg: var(--bs-success-text-emphasis); + --bs-list-group-active-border-color: var(--bs-success-text-emphasis); } .list-group-item-info { - color: #055160; - background-color: #cff4fc; } - .list-group-item-info.list-group-item-action:hover, .list-group-item-info.list-group-item-action:focus { - color: #055160; - background-color: #badce3; } - .list-group-item-info.list-group-item-action.active { - color: #fff; - background-color: #055160; - border-color: #055160; } + --bs-list-group-color: var(--bs-info-text-emphasis); + --bs-list-group-bg: var(--bs-info-bg-subtle); + --bs-list-group-border-color: var(--bs-info-border-subtle); + --bs-list-group-action-hover-color: var(--bs-emphasis-color); + --bs-list-group-action-hover-bg: var(--bs-info-border-subtle); + --bs-list-group-action-active-color: var(--bs-emphasis-color); + --bs-list-group-action-active-bg: var(--bs-info-border-subtle); + --bs-list-group-active-color: var(--bs-info-bg-subtle); + --bs-list-group-active-bg: var(--bs-info-text-emphasis); + --bs-list-group-active-border-color: var(--bs-info-text-emphasis); } .list-group-item-warning { - color: #664d03; - background-color: #fff3cd; } - .list-group-item-warning.list-group-item-action:hover, .list-group-item-warning.list-group-item-action:focus { - color: #664d03; - background-color: #e6dbb9; } - .list-group-item-warning.list-group-item-action.active { - color: #fff; - background-color: #664d03; - border-color: #664d03; } + --bs-list-group-color: var(--bs-warning-text-emphasis); + --bs-list-group-bg: var(--bs-warning-bg-subtle); + --bs-list-group-border-color: var(--bs-warning-border-subtle); + --bs-list-group-action-hover-color: var(--bs-emphasis-color); + --bs-list-group-action-hover-bg: var(--bs-warning-border-subtle); + --bs-list-group-action-active-color: var(--bs-emphasis-color); + --bs-list-group-action-active-bg: var(--bs-warning-border-subtle); + --bs-list-group-active-color: var(--bs-warning-bg-subtle); + --bs-list-group-active-bg: var(--bs-warning-text-emphasis); + --bs-list-group-active-border-color: var(--bs-warning-text-emphasis); } .list-group-item-danger { - color: #842029; - background-color: #f8d7da; } - .list-group-item-danger.list-group-item-action:hover, .list-group-item-danger.list-group-item-action:focus { - color: #842029; - background-color: #dfc2c4; } - .list-group-item-danger.list-group-item-action.active { - color: #fff; - background-color: #842029; - border-color: #842029; } + --bs-list-group-color: var(--bs-danger-text-emphasis); + --bs-list-group-bg: var(--bs-danger-bg-subtle); + --bs-list-group-border-color: var(--bs-danger-border-subtle); + --bs-list-group-action-hover-color: var(--bs-emphasis-color); + --bs-list-group-action-hover-bg: var(--bs-danger-border-subtle); + --bs-list-group-action-active-color: var(--bs-emphasis-color); + --bs-list-group-action-active-bg: var(--bs-danger-border-subtle); + --bs-list-group-active-color: var(--bs-danger-bg-subtle); + --bs-list-group-active-bg: var(--bs-danger-text-emphasis); + --bs-list-group-active-border-color: var(--bs-danger-text-emphasis); } .list-group-item-light { - color: #636464; - background-color: #fefefe; } - .list-group-item-light.list-group-item-action:hover, .list-group-item-light.list-group-item-action:focus { - color: #636464; - background-color: #e5e5e5; } - .list-group-item-light.list-group-item-action.active { - color: #fff; - background-color: #636464; - border-color: #636464; } + --bs-list-group-color: var(--bs-light-text-emphasis); + --bs-list-group-bg: var(--bs-light-bg-subtle); + --bs-list-group-border-color: var(--bs-light-border-subtle); + --bs-list-group-action-hover-color: var(--bs-emphasis-color); + --bs-list-group-action-hover-bg: var(--bs-light-border-subtle); + --bs-list-group-action-active-color: var(--bs-emphasis-color); + --bs-list-group-action-active-bg: var(--bs-light-border-subtle); + --bs-list-group-active-color: var(--bs-light-bg-subtle); + --bs-list-group-active-bg: var(--bs-light-text-emphasis); + --bs-list-group-active-border-color: var(--bs-light-text-emphasis); } .list-group-item-dark { - color: #141619; - background-color: #d3d3d4; } - .list-group-item-dark.list-group-item-action:hover, .list-group-item-dark.list-group-item-action:focus { - color: #141619; - background-color: #bebebf; } - .list-group-item-dark.list-group-item-action.active { - color: #fff; - background-color: #141619; - border-color: #141619; } + --bs-list-group-color: var(--bs-dark-text-emphasis); + --bs-list-group-bg: var(--bs-dark-bg-subtle); + --bs-list-group-border-color: var(--bs-dark-border-subtle); + --bs-list-group-action-hover-color: var(--bs-emphasis-color); + --bs-list-group-action-hover-bg: var(--bs-dark-border-subtle); + --bs-list-group-action-active-color: var(--bs-emphasis-color); + --bs-list-group-action-active-bg: var(--bs-dark-border-subtle); + --bs-list-group-active-color: var(--bs-dark-bg-subtle); + --bs-list-group-active-bg: var(--bs-dark-text-emphasis); + --bs-list-group-active-border-color: var(--bs-dark-text-emphasis); } .btn-close { + --bs-btn-close-color: #000; + --bs-btn-close-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e"); + --bs-btn-close-opacity: 0.5; + --bs-btn-close-hover-opacity: 0.75; + --bs-btn-close-focus-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25); + --bs-btn-close-focus-opacity: 1; + --bs-btn-close-disabled-opacity: 0.25; + --bs-btn-close-white-filter: invert(1) grayscale(100%) brightness(200%); box-sizing: content-box; width: 1em; height: 1em; padding: 0.25em 0.25em; - color: #000; - background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat; + color: var(--bs-btn-close-color); + background: transparent var(--bs-btn-close-bg) center/1em auto no-repeat; border: 0; - border-radius: 0.25rem; - opacity: 0.5; } + border-radius: 0.375rem; + opacity: var(--bs-btn-close-opacity); } .btn-close:hover { - color: #000; + color: var(--bs-btn-close-color); text-decoration: none; - opacity: 0.75; } + opacity: var(--bs-btn-close-hover-opacity); } .btn-close:focus { outline: 0; - box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25); - opacity: 1; } + box-shadow: var(--bs-btn-close-focus-shadow); + opacity: var(--bs-btn-close-focus-opacity); } .btn-close:disabled, .btn-close.disabled { pointer-events: none; user-select: none; - opacity: 0.25; } + opacity: var(--bs-btn-close-disabled-opacity); } .btn-close-white { - filter: invert(1) grayscale(100%) brightness(200%); } + filter: var(--bs-btn-close-white-filter); } + +[data-bs-theme="dark"] .btn-close { + filter: var(--bs-btn-close-white-filter); } .toast { - width: 350px; + --bs-toast-zindex: 1090; + --bs-toast-padding-x: 0.75rem; + --bs-toast-padding-y: 0.5rem; + --bs-toast-spacing: 1.5rem; + --bs-toast-max-width: 350px; + --bs-toast-font-size: 0.875rem; + --bs-toast-color: ; + --bs-toast-bg: rgba(var(--bs-body-bg-rgb), 0.85); + --bs-toast-border-width: var(--bs-border-width); + --bs-toast-border-color: var(--bs-border-color-translucent); + --bs-toast-border-radius: var(--bs-border-radius); + --bs-toast-box-shadow: var(--bs-box-shadow); + --bs-toast-header-color: var(--bs-secondary-color); + --bs-toast-header-bg: rgba(var(--bs-body-bg-rgb), 0.85); + --bs-toast-header-border-color: var(--bs-border-color-translucent); + width: var(--bs-toast-max-width); max-width: 100%; - font-size: 0.875rem; + font-size: var(--bs-toast-font-size); + color: var(--bs-toast-color); pointer-events: auto; - background-color: rgba(255, 255, 255, 0.85); + background-color: var(--bs-toast-bg); background-clip: padding-box; - border: 1px solid rgba(0, 0, 0, 0.1); - box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15); - border-radius: 0.25rem; } + border: var(--bs-toast-border-width) solid var(--bs-toast-border-color); + box-shadow: var(--bs-toast-box-shadow); + border-radius: var(--bs-toast-border-radius); } .toast.showing { opacity: 0; } .toast:not(.show) { display: none; } .toast-container { + --bs-toast-zindex: 1090; + position: absolute; + z-index: var(--bs-toast-zindex); width: max-content; max-width: 100%; pointer-events: none; } .toast-container > :not(:last-child) { - margin-bottom: 0.75rem; } + margin-bottom: var(--bs-toast-spacing); } .toast-header { display: flex; align-items: center; - padding: 0.5rem 0.75rem; - color: #6c757d; - background-color: rgba(255, 255, 255, 0.85); + padding: var(--bs-toast-padding-y) var(--bs-toast-padding-x); + color: var(--bs-toast-header-color); + background-color: var(--bs-toast-header-bg); background-clip: padding-box; - border-bottom: 1px solid rgba(0, 0, 0, 0.05); - border-top-left-radius: calc(0.25rem - 1px); - border-top-right-radius: calc(0.25rem - 1px); } + border-bottom: var(--bs-toast-border-width) solid var(--bs-toast-header-border-color); + border-top-left-radius: calc(var(--bs-toast-border-radius) - var(--bs-toast-border-width)); + border-top-right-radius: calc(var(--bs-toast-border-radius) - var(--bs-toast-border-width)); } .toast-header .btn-close { - margin-right: -0.375rem; - margin-left: 0.75rem; } + margin-right: calc(-.5 * var(--bs-toast-padding-x)); + margin-left: var(--bs-toast-padding-x); } .toast-body { - padding: 0.75rem; + padding: var(--bs-toast-padding-x); word-wrap: break-word; } .modal { + --bs-modal-zindex: 1055; + --bs-modal-width: 500px; + --bs-modal-padding: 1rem; + --bs-modal-margin: 0.5rem; + --bs-modal-color: ; + --bs-modal-bg: var(--bs-body-bg); + --bs-modal-border-color: var(--bs-border-color-translucent); + --bs-modal-border-width: var(--bs-border-width); + --bs-modal-border-radius: var(--bs-border-radius-lg); + --bs-modal-box-shadow: var(--bs-box-shadow-sm); + --bs-modal-inner-border-radius: calc(var(--bs-border-radius-lg) - (var(--bs-border-width))); + --bs-modal-header-padding-x: 1rem; + --bs-modal-header-padding-y: 1rem; + --bs-modal-header-padding: 1rem 1rem; + --bs-modal-header-border-color: var(--bs-border-color); + --bs-modal-header-border-width: var(--bs-border-width); + --bs-modal-title-line-height: 1.5; + --bs-modal-footer-gap: 0.5rem; + --bs-modal-footer-bg: ; + --bs-modal-footer-border-color: var(--bs-border-color); + --bs-modal-footer-border-width: var(--bs-border-width); position: fixed; top: 0; left: 0; - z-index: 1055; + z-index: var(--bs-modal-zindex); display: none; width: 100%; height: 100%; @@ -4107,7 +4464,7 @@ textarea.form-control-lg { .modal-dialog { position: relative; width: auto; - margin: 0.5rem; + margin: var(--bs-modal-margin); pointer-events: none; } .modal.fade .modal-dialog { transition: transform 0.3s ease-out; @@ -4121,7 +4478,7 @@ textarea.form-control-lg { transform: scale(1.02); } .modal-dialog-scrollable { - height: calc(100% - 1rem); } + height: calc(100% - var(--bs-modal-margin) * 2); } .modal-dialog-scrollable .modal-content { max-height: 100%; overflow: hidden; } @@ -4131,87 +4488,91 @@ textarea.form-control-lg { .modal-dialog-centered { display: flex; align-items: center; - min-height: calc(100% - 1rem); } + min-height: calc(100% - var(--bs-modal-margin) * 2); } .modal-content { position: relative; display: flex; flex-direction: column; width: 100%; + color: var(--bs-modal-color); pointer-events: auto; - background-color: #fff; + background-color: var(--bs-modal-bg); background-clip: padding-box; - border: 1px solid rgba(0, 0, 0, 0.2); - border-radius: 0.3rem; + border: var(--bs-modal-border-width) solid var(--bs-modal-border-color); + border-radius: var(--bs-modal-border-radius); outline: 0; } .modal-backdrop { + --bs-backdrop-zindex: 1050; + --bs-backdrop-bg: #000; + --bs-backdrop-opacity: 0.5; position: fixed; top: 0; left: 0; - z-index: 1050; + z-index: var(--bs-backdrop-zindex); width: 100vw; height: 100vh; - background-color: #000; } + background-color: var(--bs-backdrop-bg); } .modal-backdrop.fade { opacity: 0; } .modal-backdrop.show { - opacity: 0.5; } + opacity: var(--bs-backdrop-opacity); } .modal-header { display: flex; flex-shrink: 0; align-items: center; - justify-content: space-between; - padding: 1rem 1rem; - border-bottom: 1px solid #dee2e6; - border-top-left-radius: calc(0.3rem - 1px); - border-top-right-radius: calc(0.3rem - 1px); } + padding: var(--bs-modal-header-padding); + border-bottom: var(--bs-modal-header-border-width) solid var(--bs-modal-header-border-color); + border-top-left-radius: var(--bs-modal-inner-border-radius); + border-top-right-radius: var(--bs-modal-inner-border-radius); } .modal-header .btn-close { - padding: 0.5rem 0.5rem; - margin: -0.5rem -0.5rem -0.5rem auto; } + padding: calc(var(--bs-modal-header-padding-y) * .5) calc(var(--bs-modal-header-padding-x) * .5); + margin: calc(-.5 * var(--bs-modal-header-padding-y)) calc(-.5 * var(--bs-modal-header-padding-x)) calc(-.5 * var(--bs-modal-header-padding-y)) auto; } .modal-title { margin-bottom: 0; - line-height: 1.5; } + line-height: var(--bs-modal-title-line-height); } .modal-body { position: relative; flex: 1 1 auto; - padding: 1rem; } + padding: var(--bs-modal-padding); } .modal-footer { display: flex; - flex-wrap: wrap; flex-shrink: 0; + flex-wrap: wrap; align-items: center; justify-content: flex-end; - padding: 0.75rem; - border-top: 1px solid #dee2e6; - border-bottom-right-radius: calc(0.3rem - 1px); - border-bottom-left-radius: calc(0.3rem - 1px); } + padding: calc(var(--bs-modal-padding) - var(--bs-modal-footer-gap) * .5); + background-color: var(--bs-modal-footer-bg); + border-top: var(--bs-modal-footer-border-width) solid var(--bs-modal-footer-border-color); + border-bottom-right-radius: var(--bs-modal-inner-border-radius); + border-bottom-left-radius: var(--bs-modal-inner-border-radius); } .modal-footer > * { - margin: 0.25rem; } + margin: calc(var(--bs-modal-footer-gap) * .5); } @media (min-width: 576px) { + .modal { + --bs-modal-margin: 1.75rem; + --bs-modal-box-shadow: var(--bs-box-shadow); } .modal-dialog { - max-width: 500px; - margin: 1.75rem auto; } - .modal-dialog-scrollable { - height: calc(100% - 3.5rem); } - .modal-dialog-centered { - min-height: calc(100% - 3.5rem); } + max-width: var(--bs-modal-width); + margin-right: auto; + margin-left: auto; } .modal-sm { - max-width: 300px; } } + --bs-modal-width: 300px; } } @media (min-width: 992px) { .modal-lg, .modal-xl { - max-width: 800px; } } + --bs-modal-width: 800px; } } @media (min-width: 1200px) { .modal-xl { - max-width: 1140px; } } + --bs-modal-width: 1140px; } } .modal-fullscreen { width: 100vw; @@ -4222,12 +4583,11 @@ textarea.form-control-lg { height: 100%; border: 0; border-radius: 0; } - .modal-fullscreen .modal-header { + .modal-fullscreen .modal-header, + .modal-fullscreen .modal-footer { border-radius: 0; } .modal-fullscreen .modal-body { overflow-y: auto; } - .modal-fullscreen .modal-footer { - border-radius: 0; } @media (max-width: 575.98px) { .modal-fullscreen-sm-down { @@ -4239,12 +4599,11 @@ textarea.form-control-lg { height: 100%; border: 0; border-radius: 0; } - .modal-fullscreen-sm-down .modal-header { + .modal-fullscreen-sm-down .modal-header, + .modal-fullscreen-sm-down .modal-footer { border-radius: 0; } .modal-fullscreen-sm-down .modal-body { - overflow-y: auto; } - .modal-fullscreen-sm-down .modal-footer { - border-radius: 0; } } + overflow-y: auto; } } @media (max-width: 767.98px) { .modal-fullscreen-md-down { @@ -4256,12 +4615,11 @@ textarea.form-control-lg { height: 100%; border: 0; border-radius: 0; } - .modal-fullscreen-md-down .modal-header { + .modal-fullscreen-md-down .modal-header, + .modal-fullscreen-md-down .modal-footer { border-radius: 0; } .modal-fullscreen-md-down .modal-body { - overflow-y: auto; } - .modal-fullscreen-md-down .modal-footer { - border-radius: 0; } } + overflow-y: auto; } } @media (max-width: 991.98px) { .modal-fullscreen-lg-down { @@ -4273,12 +4631,11 @@ textarea.form-control-lg { height: 100%; border: 0; border-radius: 0; } - .modal-fullscreen-lg-down .modal-header { + .modal-fullscreen-lg-down .modal-header, + .modal-fullscreen-lg-down .modal-footer { border-radius: 0; } .modal-fullscreen-lg-down .modal-body { - overflow-y: auto; } - .modal-fullscreen-lg-down .modal-footer { - border-radius: 0; } } + overflow-y: auto; } } @media (max-width: 1199.98px) { .modal-fullscreen-xl-down { @@ -4290,12 +4647,11 @@ textarea.form-control-lg { height: 100%; border: 0; border-radius: 0; } - .modal-fullscreen-xl-down .modal-header { + .modal-fullscreen-xl-down .modal-header, + .modal-fullscreen-xl-down .modal-footer { border-radius: 0; } .modal-fullscreen-xl-down .modal-body { - overflow-y: auto; } - .modal-fullscreen-xl-down .modal-footer { - border-radius: 0; } } + overflow-y: auto; } } @media (max-width: 1399.98px) { .modal-fullscreen-xxl-down { @@ -4307,18 +4663,28 @@ textarea.form-control-lg { height: 100%; border: 0; border-radius: 0; } - .modal-fullscreen-xxl-down .modal-header { + .modal-fullscreen-xxl-down .modal-header, + .modal-fullscreen-xxl-down .modal-footer { border-radius: 0; } .modal-fullscreen-xxl-down .modal-body { - overflow-y: auto; } - .modal-fullscreen-xxl-down .modal-footer { - border-radius: 0; } } + overflow-y: auto; } } .tooltip { - position: absolute; - z-index: 1080; + --bs-tooltip-zindex: 1080; + --bs-tooltip-max-width: 200px; + --bs-tooltip-padding-x: 0.5rem; + --bs-tooltip-padding-y: 0.25rem; + --bs-tooltip-margin: ; + --bs-tooltip-font-size: 0.875rem; + --bs-tooltip-color: var(--bs-body-bg); + --bs-tooltip-bg: var(--bs-emphasis-color); + --bs-tooltip-border-radius: var(--bs-border-radius); + --bs-tooltip-opacity: 0.9; + --bs-tooltip-arrow-width: 0.8rem; + --bs-tooltip-arrow-height: 0.4rem; + z-index: var(--bs-tooltip-zindex); display: block; - margin: 0; + margin: var(--bs-tooltip-margin); font-family: var(--bs-font-sans-serif); font-style: normal; font-weight: 400; @@ -4330,80 +4696,92 @@ textarea.form-control-lg { text-transform: none; letter-spacing: normal; word-break: normal; - word-spacing: normal; white-space: normal; + word-spacing: normal; line-break: auto; - font-size: 0.875rem; + font-size: var(--bs-tooltip-font-size); word-wrap: break-word; opacity: 0; } .tooltip.show { - opacity: 0.9; } + opacity: var(--bs-tooltip-opacity); } .tooltip .tooltip-arrow { - position: absolute; display: block; - width: 0.8rem; - height: 0.4rem; } + width: var(--bs-tooltip-arrow-width); + height: var(--bs-tooltip-arrow-height); } .tooltip .tooltip-arrow::before { position: absolute; content: ""; border-color: transparent; border-style: solid; } -.bs-tooltip-top, .bs-tooltip-auto[data-popper-placement^="top"] { - padding: 0.4rem 0; } - .bs-tooltip-top .tooltip-arrow, .bs-tooltip-auto[data-popper-placement^="top"] .tooltip-arrow { - bottom: 0; } - .bs-tooltip-top .tooltip-arrow::before, .bs-tooltip-auto[data-popper-placement^="top"] .tooltip-arrow::before { - top: -1px; - border-width: 0.4rem 0.4rem 0; - border-top-color: #000; } +.bs-tooltip-top .tooltip-arrow, .bs-tooltip-auto[data-popper-placement^="top"] .tooltip-arrow { + bottom: calc(-1 * var(--bs-tooltip-arrow-height)); } + .bs-tooltip-top .tooltip-arrow::before, .bs-tooltip-auto[data-popper-placement^="top"] .tooltip-arrow::before { + top: -1px; + border-width: var(--bs-tooltip-arrow-height) calc(var(--bs-tooltip-arrow-width) * .5) 0; + border-top-color: var(--bs-tooltip-bg); } -.bs-tooltip-end, .bs-tooltip-auto[data-popper-placement^="right"] { - padding: 0 0.4rem; } - .bs-tooltip-end .tooltip-arrow, .bs-tooltip-auto[data-popper-placement^="right"] .tooltip-arrow { - left: 0; - width: 0.4rem; - height: 0.8rem; } - .bs-tooltip-end .tooltip-arrow::before, .bs-tooltip-auto[data-popper-placement^="right"] .tooltip-arrow::before { - right: -1px; - border-width: 0.4rem 0.4rem 0.4rem 0; - border-right-color: #000; } +/* rtl:begin:ignore */ +.bs-tooltip-end .tooltip-arrow, .bs-tooltip-auto[data-popper-placement^="right"] .tooltip-arrow { + left: calc(-1 * var(--bs-tooltip-arrow-height)); + width: var(--bs-tooltip-arrow-height); + height: var(--bs-tooltip-arrow-width); } + .bs-tooltip-end .tooltip-arrow::before, .bs-tooltip-auto[data-popper-placement^="right"] .tooltip-arrow::before { + right: -1px; + border-width: calc(var(--bs-tooltip-arrow-width) * .5) var(--bs-tooltip-arrow-height) calc(var(--bs-tooltip-arrow-width) * .5) 0; + border-right-color: var(--bs-tooltip-bg); } -.bs-tooltip-bottom, .bs-tooltip-auto[data-popper-placement^="bottom"] { - padding: 0.4rem 0; } - .bs-tooltip-bottom .tooltip-arrow, .bs-tooltip-auto[data-popper-placement^="bottom"] .tooltip-arrow { - top: 0; } - .bs-tooltip-bottom .tooltip-arrow::before, .bs-tooltip-auto[data-popper-placement^="bottom"] .tooltip-arrow::before { - bottom: -1px; - border-width: 0 0.4rem 0.4rem; - border-bottom-color: #000; } +/* rtl:end:ignore */ +.bs-tooltip-bottom .tooltip-arrow, .bs-tooltip-auto[data-popper-placement^="bottom"] .tooltip-arrow { + top: calc(-1 * var(--bs-tooltip-arrow-height)); } + .bs-tooltip-bottom .tooltip-arrow::before, .bs-tooltip-auto[data-popper-placement^="bottom"] .tooltip-arrow::before { + bottom: -1px; + border-width: 0 calc(var(--bs-tooltip-arrow-width) * .5) var(--bs-tooltip-arrow-height); + border-bottom-color: var(--bs-tooltip-bg); } -.bs-tooltip-start, .bs-tooltip-auto[data-popper-placement^="left"] { - padding: 0 0.4rem; } - .bs-tooltip-start .tooltip-arrow, .bs-tooltip-auto[data-popper-placement^="left"] .tooltip-arrow { - right: 0; - width: 0.4rem; - height: 0.8rem; } - .bs-tooltip-start .tooltip-arrow::before, .bs-tooltip-auto[data-popper-placement^="left"] .tooltip-arrow::before { - left: -1px; - border-width: 0.4rem 0 0.4rem 0.4rem; - border-left-color: #000; } +/* rtl:begin:ignore */ +.bs-tooltip-start .tooltip-arrow, .bs-tooltip-auto[data-popper-placement^="left"] .tooltip-arrow { + right: calc(-1 * var(--bs-tooltip-arrow-height)); + width: var(--bs-tooltip-arrow-height); + height: var(--bs-tooltip-arrow-width); } + .bs-tooltip-start .tooltip-arrow::before, .bs-tooltip-auto[data-popper-placement^="left"] .tooltip-arrow::before { + left: -1px; + border-width: calc(var(--bs-tooltip-arrow-width) * .5) 0 calc(var(--bs-tooltip-arrow-width) * .5) var(--bs-tooltip-arrow-height); + border-left-color: var(--bs-tooltip-bg); } +/* rtl:end:ignore */ .tooltip-inner { - max-width: 200px; - padding: 0.25rem 0.5rem; - color: #fff; + max-width: var(--bs-tooltip-max-width); + padding: var(--bs-tooltip-padding-y) var(--bs-tooltip-padding-x); + color: var(--bs-tooltip-color); text-align: center; - background-color: #000; - border-radius: 0.25rem; } + background-color: var(--bs-tooltip-bg); + border-radius: var(--bs-tooltip-border-radius); } .popover { - position: absolute; - top: 0; - left: 0 /* rtl:ignore */; - z-index: 1070; + --bs-popover-zindex: 1070; + --bs-popover-max-width: 276px; + --bs-popover-font-size: 0.875rem; + --bs-popover-bg: var(--bs-body-bg); + --bs-popover-border-width: var(--bs-border-width); + --bs-popover-border-color: var(--bs-border-color-translucent); + --bs-popover-border-radius: var(--bs-border-radius-lg); + --bs-popover-inner-border-radius: calc(var(--bs-border-radius-lg) - var(--bs-border-width)); + --bs-popover-box-shadow: var(--bs-box-shadow); + --bs-popover-header-padding-x: 1rem; + --bs-popover-header-padding-y: 0.5rem; + --bs-popover-header-font-size: 1rem; + --bs-popover-header-color: inherit; + --bs-popover-header-bg: var(--bs-secondary-bg); + --bs-popover-body-padding-x: 1rem; + --bs-popover-body-padding-y: 1rem; + --bs-popover-body-color: var(--bs-body-color); + --bs-popover-arrow-width: 1rem; + --bs-popover-arrow-height: 0.5rem; + --bs-popover-arrow-border: var(--bs-popover-border-color); + z-index: var(--bs-popover-zindex); display: block; - max-width: 276px; + max-width: var(--bs-popover-max-width); font-family: var(--bs-font-sans-serif); font-style: normal; font-weight: 400; @@ -4415,99 +4793,104 @@ textarea.form-control-lg { text-transform: none; letter-spacing: normal; word-break: normal; - word-spacing: normal; white-space: normal; + word-spacing: normal; line-break: auto; - font-size: 0.875rem; + font-size: var(--bs-popover-font-size); word-wrap: break-word; - background-color: #fff; + background-color: var(--bs-popover-bg); background-clip: padding-box; - border: 1px solid rgba(0, 0, 0, 0.2); - border-radius: 0.3rem; } + border: var(--bs-popover-border-width) solid var(--bs-popover-border-color); + border-radius: var(--bs-popover-border-radius); } .popover .popover-arrow { - position: absolute; display: block; - width: 1rem; - height: 0.5rem; } + width: var(--bs-popover-arrow-width); + height: var(--bs-popover-arrow-height); } .popover .popover-arrow::before, .popover .popover-arrow::after { position: absolute; display: block; content: ""; border-color: transparent; - border-style: solid; } + border-style: solid; + border-width: 0; } .bs-popover-top > .popover-arrow, .bs-popover-auto[data-popper-placement^="top"] > .popover-arrow { - bottom: calc(-0.5rem - 1px); } + bottom: calc(-1 * (var(--bs-popover-arrow-height)) - var(--bs-popover-border-width)); } + .bs-popover-top > .popover-arrow::before, .bs-popover-auto[data-popper-placement^="top"] > .popover-arrow::before, .bs-popover-top > .popover-arrow::after, .bs-popover-auto[data-popper-placement^="top"] > .popover-arrow::after { + border-width: var(--bs-popover-arrow-height) calc(var(--bs-popover-arrow-width) * .5) 0; } .bs-popover-top > .popover-arrow::before, .bs-popover-auto[data-popper-placement^="top"] > .popover-arrow::before { bottom: 0; - border-width: 0.5rem 0.5rem 0; - border-top-color: rgba(0, 0, 0, 0.25); } + border-top-color: var(--bs-popover-arrow-border); } .bs-popover-top > .popover-arrow::after, .bs-popover-auto[data-popper-placement^="top"] > .popover-arrow::after { - bottom: 1px; - border-width: 0.5rem 0.5rem 0; - border-top-color: #fff; } + bottom: var(--bs-popover-border-width); + border-top-color: var(--bs-popover-bg); } +/* rtl:begin:ignore */ .bs-popover-end > .popover-arrow, .bs-popover-auto[data-popper-placement^="right"] > .popover-arrow { - left: calc(-0.5rem - 1px); - width: 0.5rem; - height: 1rem; } + left: calc(-1 * (var(--bs-popover-arrow-height)) - var(--bs-popover-border-width)); + width: var(--bs-popover-arrow-height); + height: var(--bs-popover-arrow-width); } + .bs-popover-end > .popover-arrow::before, .bs-popover-auto[data-popper-placement^="right"] > .popover-arrow::before, .bs-popover-end > .popover-arrow::after, .bs-popover-auto[data-popper-placement^="right"] > .popover-arrow::after { + border-width: calc(var(--bs-popover-arrow-width) * .5) var(--bs-popover-arrow-height) calc(var(--bs-popover-arrow-width) * .5) 0; } .bs-popover-end > .popover-arrow::before, .bs-popover-auto[data-popper-placement^="right"] > .popover-arrow::before { left: 0; - border-width: 0.5rem 0.5rem 0.5rem 0; - border-right-color: rgba(0, 0, 0, 0.25); } + border-right-color: var(--bs-popover-arrow-border); } .bs-popover-end > .popover-arrow::after, .bs-popover-auto[data-popper-placement^="right"] > .popover-arrow::after { - left: 1px; - border-width: 0.5rem 0.5rem 0.5rem 0; - border-right-color: #fff; } + left: var(--bs-popover-border-width); + border-right-color: var(--bs-popover-bg); } +/* rtl:end:ignore */ .bs-popover-bottom > .popover-arrow, .bs-popover-auto[data-popper-placement^="bottom"] > .popover-arrow { - top: calc(-0.5rem - 1px); } + top: calc(-1 * (var(--bs-popover-arrow-height)) - var(--bs-popover-border-width)); } + .bs-popover-bottom > .popover-arrow::before, .bs-popover-auto[data-popper-placement^="bottom"] > .popover-arrow::before, .bs-popover-bottom > .popover-arrow::after, .bs-popover-auto[data-popper-placement^="bottom"] > .popover-arrow::after { + border-width: 0 calc(var(--bs-popover-arrow-width) * .5) var(--bs-popover-arrow-height); } .bs-popover-bottom > .popover-arrow::before, .bs-popover-auto[data-popper-placement^="bottom"] > .popover-arrow::before { top: 0; - border-width: 0 0.5rem 0.5rem 0.5rem; - border-bottom-color: rgba(0, 0, 0, 0.25); } + border-bottom-color: var(--bs-popover-arrow-border); } .bs-popover-bottom > .popover-arrow::after, .bs-popover-auto[data-popper-placement^="bottom"] > .popover-arrow::after { - top: 1px; - border-width: 0 0.5rem 0.5rem 0.5rem; - border-bottom-color: #fff; } + top: var(--bs-popover-border-width); + border-bottom-color: var(--bs-popover-bg); } .bs-popover-bottom .popover-header::before, .bs-popover-auto[data-popper-placement^="bottom"] .popover-header::before { position: absolute; top: 0; left: 50%; display: block; - width: 1rem; - margin-left: -0.5rem; + width: var(--bs-popover-arrow-width); + margin-left: calc(-.5 * var(--bs-popover-arrow-width)); content: ""; - border-bottom: 1px solid #f0f0f0; } + border-bottom: var(--bs-popover-border-width) solid var(--bs-popover-header-bg); } +/* rtl:begin:ignore */ .bs-popover-start > .popover-arrow, .bs-popover-auto[data-popper-placement^="left"] > .popover-arrow { - right: calc(-0.5rem - 1px); - width: 0.5rem; - height: 1rem; } + right: calc(-1 * (var(--bs-popover-arrow-height)) - var(--bs-popover-border-width)); + width: var(--bs-popover-arrow-height); + height: var(--bs-popover-arrow-width); } + .bs-popover-start > .popover-arrow::before, .bs-popover-auto[data-popper-placement^="left"] > .popover-arrow::before, .bs-popover-start > .popover-arrow::after, .bs-popover-auto[data-popper-placement^="left"] > .popover-arrow::after { + border-width: calc(var(--bs-popover-arrow-width) * .5) 0 calc(var(--bs-popover-arrow-width) * .5) var(--bs-popover-arrow-height); } .bs-popover-start > .popover-arrow::before, .bs-popover-auto[data-popper-placement^="left"] > .popover-arrow::before { right: 0; - border-width: 0.5rem 0 0.5rem 0.5rem; - border-left-color: rgba(0, 0, 0, 0.25); } + border-left-color: var(--bs-popover-arrow-border); } .bs-popover-start > .popover-arrow::after, .bs-popover-auto[data-popper-placement^="left"] > .popover-arrow::after { - right: 1px; - border-width: 0.5rem 0 0.5rem 0.5rem; - border-left-color: #fff; } + right: var(--bs-popover-border-width); + border-left-color: var(--bs-popover-bg); } +/* rtl:end:ignore */ .popover-header { - padding: 0.5rem 1rem; + padding: var(--bs-popover-header-padding-y) var(--bs-popover-header-padding-x); margin-bottom: 0; - font-size: 1rem; - background-color: #f0f0f0; - border-bottom: 1px solid rgba(0, 0, 0, 0.2); - border-top-left-radius: calc(0.3rem - 1px); - border-top-right-radius: calc(0.3rem - 1px); } + font-size: var(--bs-popover-header-font-size); + color: var(--bs-popover-header-color); + background-color: var(--bs-popover-header-bg); + border-bottom: var(--bs-popover-border-width) solid var(--bs-popover-border-color); + border-top-left-radius: var(--bs-popover-inner-border-radius); + border-top-right-radius: var(--bs-popover-inner-border-radius); } .popover-header:empty { display: none; } .popover-body { - padding: 1rem 1rem; - color: #212529; } + padding: var(--bs-popover-body-padding-y) var(--bs-popover-body-padding-x); + color: var(--bs-popover-body-color); } .carousel { position: relative; } @@ -4540,7 +4923,6 @@ textarea.form-control-lg { .carousel-item-prev { display: block; } -/* rtl:begin:ignore */ .carousel-item-next:not(.carousel-item-start), .active.carousel-item-end { transform: translateX(100%); } @@ -4549,7 +4931,6 @@ textarea.form-control-lg { .active.carousel-item-start { transform: translateX(-100%); } -/* rtl:end:ignore */ .carousel-fade .carousel-item { opacity: 0; transition-property: opacity; @@ -4614,19 +4995,11 @@ textarea.form-control-lg { background-position: 50%; background-size: 100% 100%; } -/* rtl:options: { - "autoRename": true, - "stringMap":[ { - "name" : "prev-next", - "search" : "prev", - "replace" : "next" - } ] -} */ .carousel-control-prev-icon { - background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z'/%3e%3c/svg%3e"); } + background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z'/%3e%3c/svg%3e") /*rtl:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e")*/; } .carousel-control-next-icon { - background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e"); } + background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e") /*rtl:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23fff'%3e%3cpath d='M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z'/%3e%3c/svg%3e")*/; } .carousel-indicators { position: absolute; @@ -4639,8 +5012,7 @@ textarea.form-control-lg { padding: 0; margin-right: 15%; margin-bottom: 1rem; - margin-left: 15%; - list-style: none; } + margin-left: 15%; } .carousel-indicators [data-bs-target] { box-sizing: content-box; flex: 0 1 auto; @@ -4684,24 +5056,44 @@ textarea.form-control-lg { .carousel-dark .carousel-caption { color: #000; } +[data-bs-theme="dark"] .carousel .carousel-control-prev-icon, +[data-bs-theme="dark"] .carousel .carousel-control-next-icon, .carousel[data-bs-theme="dark"] .carousel-control-prev-icon, +.carousel[data-bs-theme="dark"] .carousel-control-next-icon { + filter: invert(1) grayscale(100); } + +[data-bs-theme="dark"] .carousel .carousel-indicators [data-bs-target], .carousel[data-bs-theme="dark"] .carousel-indicators [data-bs-target] { + background-color: #000; } + +[data-bs-theme="dark"] .carousel .carousel-caption, .carousel[data-bs-theme="dark"] .carousel-caption { + color: #000; } + +.spinner-grow, +.spinner-border { + display: inline-block; + width: var(--bs-spinner-width); + height: var(--bs-spinner-height); + vertical-align: var(--bs-spinner-vertical-align); + border-radius: 50%; + animation: var(--bs-spinner-animation-speed) linear infinite var(--bs-spinner-animation-name); } + @keyframes spinner-border { to { transform: rotate(360deg) /* rtl:ignore */; } } .spinner-border { - display: inline-block; - width: 2rem; - height: 2rem; - vertical-align: -0.125em; - border: 0.25em solid currentColor; - border-right-color: transparent; - border-radius: 50%; - animation: 0.75s linear infinite spinner-border; } + --bs-spinner-width: 2rem; + --bs-spinner-height: 2rem; + --bs-spinner-vertical-align: -0.125em; + --bs-spinner-border-width: 0.25em; + --bs-spinner-animation-speed: 0.75s; + --bs-spinner-animation-name: spinner-border; + border: var(--bs-spinner-border-width) solid currentcolor; + border-right-color: transparent; } .spinner-border-sm { - width: 1rem; - height: 1rem; - border-width: 0.2em; } + --bs-spinner-width: 1rem; + --bs-spinner-height: 1rem; + --bs-spinner-border-width: 0.2em; } @keyframes spinner-grow { 0% { @@ -4711,39 +5103,405 @@ textarea.form-control-lg { transform: none; } } .spinner-grow { - display: inline-block; - width: 2rem; - height: 2rem; - vertical-align: -0.125em; - background-color: currentColor; - border-radius: 50%; - opacity: 0; - animation: 0.75s linear infinite spinner-grow; } + --bs-spinner-width: 2rem; + --bs-spinner-height: 2rem; + --bs-spinner-vertical-align: -0.125em; + --bs-spinner-animation-speed: 0.75s; + --bs-spinner-animation-name: spinner-grow; + background-color: currentcolor; + opacity: 0; } .spinner-grow-sm { - width: 1rem; - height: 1rem; } + --bs-spinner-width: 1rem; + --bs-spinner-height: 1rem; } @media (prefers-reduced-motion: reduce) { .spinner-border, .spinner-grow { - animation-duration: 1.5s; } } + --bs-spinner-animation-speed: 1.5s; } } + +.offcanvas, .offcanvas-xxl, .offcanvas-xl, .offcanvas-lg, .offcanvas-md, .offcanvas-sm { + --bs-offcanvas-zindex: 1045; + --bs-offcanvas-width: 400px; + --bs-offcanvas-height: 30vh; + --bs-offcanvas-padding-x: 1rem; + --bs-offcanvas-padding-y: 1rem; + --bs-offcanvas-color: var(--bs-body-color); + --bs-offcanvas-bg: var(--bs-body-bg); + --bs-offcanvas-border-width: var(--bs-border-width); + --bs-offcanvas-border-color: var(--bs-border-color-translucent); + --bs-offcanvas-box-shadow: var(--bs-box-shadow-sm); + --bs-offcanvas-transition: transform 0.3s ease-in-out; + --bs-offcanvas-title-line-height: 1.5; } + +@media (max-width: 575.98px) { + .offcanvas-sm { + position: fixed; + bottom: 0; + z-index: var(--bs-offcanvas-zindex); + display: flex; + flex-direction: column; + max-width: 100%; + color: var(--bs-offcanvas-color); + visibility: hidden; + background-color: var(--bs-offcanvas-bg); + background-clip: padding-box; + outline: 0; + transition: var(--bs-offcanvas-transition); } } + @media (max-width: 575.98px) and (prefers-reduced-motion: reduce) { + .offcanvas-sm { + transition: none; } } +@media (max-width: 575.98px) { + .offcanvas-sm.offcanvas-start { + top: 0; + left: 0; + width: var(--bs-offcanvas-width); + border-right: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateX(-100%); } + .offcanvas-sm.offcanvas-end { + top: 0; + right: 0; + width: var(--bs-offcanvas-width); + border-left: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateX(100%); } + .offcanvas-sm.offcanvas-top { + top: 0; + right: 0; + left: 0; + height: var(--bs-offcanvas-height); + max-height: 100%; + border-bottom: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateY(-100%); } + .offcanvas-sm.offcanvas-bottom { + right: 0; + left: 0; + height: var(--bs-offcanvas-height); + max-height: 100%; + border-top: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateY(100%); } + .offcanvas-sm.showing, .offcanvas-sm.show:not(.hiding) { + transform: none; } + .offcanvas-sm.showing, .offcanvas-sm.hiding, .offcanvas-sm.show { + visibility: visible; } } + +@media (min-width: 576px) { + .offcanvas-sm { + --bs-offcanvas-height: auto; + --bs-offcanvas-border-width: 0; + background-color: transparent !important; } + .offcanvas-sm .offcanvas-header { + display: none; } + .offcanvas-sm .offcanvas-body { + display: flex; + flex-grow: 0; + padding: 0; + overflow-y: visible; + background-color: transparent !important; } } + +@media (max-width: 767.98px) { + .offcanvas-md { + position: fixed; + bottom: 0; + z-index: var(--bs-offcanvas-zindex); + display: flex; + flex-direction: column; + max-width: 100%; + color: var(--bs-offcanvas-color); + visibility: hidden; + background-color: var(--bs-offcanvas-bg); + background-clip: padding-box; + outline: 0; + transition: var(--bs-offcanvas-transition); } } + @media (max-width: 767.98px) and (prefers-reduced-motion: reduce) { + .offcanvas-md { + transition: none; } } +@media (max-width: 767.98px) { + .offcanvas-md.offcanvas-start { + top: 0; + left: 0; + width: var(--bs-offcanvas-width); + border-right: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateX(-100%); } + .offcanvas-md.offcanvas-end { + top: 0; + right: 0; + width: var(--bs-offcanvas-width); + border-left: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateX(100%); } + .offcanvas-md.offcanvas-top { + top: 0; + right: 0; + left: 0; + height: var(--bs-offcanvas-height); + max-height: 100%; + border-bottom: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateY(-100%); } + .offcanvas-md.offcanvas-bottom { + right: 0; + left: 0; + height: var(--bs-offcanvas-height); + max-height: 100%; + border-top: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateY(100%); } + .offcanvas-md.showing, .offcanvas-md.show:not(.hiding) { + transform: none; } + .offcanvas-md.showing, .offcanvas-md.hiding, .offcanvas-md.show { + visibility: visible; } } + +@media (min-width: 768px) { + .offcanvas-md { + --bs-offcanvas-height: auto; + --bs-offcanvas-border-width: 0; + background-color: transparent !important; } + .offcanvas-md .offcanvas-header { + display: none; } + .offcanvas-md .offcanvas-body { + display: flex; + flex-grow: 0; + padding: 0; + overflow-y: visible; + background-color: transparent !important; } } + +@media (max-width: 991.98px) { + .offcanvas-lg { + position: fixed; + bottom: 0; + z-index: var(--bs-offcanvas-zindex); + display: flex; + flex-direction: column; + max-width: 100%; + color: var(--bs-offcanvas-color); + visibility: hidden; + background-color: var(--bs-offcanvas-bg); + background-clip: padding-box; + outline: 0; + transition: var(--bs-offcanvas-transition); } } + @media (max-width: 991.98px) and (prefers-reduced-motion: reduce) { + .offcanvas-lg { + transition: none; } } +@media (max-width: 991.98px) { + .offcanvas-lg.offcanvas-start { + top: 0; + left: 0; + width: var(--bs-offcanvas-width); + border-right: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateX(-100%); } + .offcanvas-lg.offcanvas-end { + top: 0; + right: 0; + width: var(--bs-offcanvas-width); + border-left: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateX(100%); } + .offcanvas-lg.offcanvas-top { + top: 0; + right: 0; + left: 0; + height: var(--bs-offcanvas-height); + max-height: 100%; + border-bottom: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateY(-100%); } + .offcanvas-lg.offcanvas-bottom { + right: 0; + left: 0; + height: var(--bs-offcanvas-height); + max-height: 100%; + border-top: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateY(100%); } + .offcanvas-lg.showing, .offcanvas-lg.show:not(.hiding) { + transform: none; } + .offcanvas-lg.showing, .offcanvas-lg.hiding, .offcanvas-lg.show { + visibility: visible; } } + +@media (min-width: 992px) { + .offcanvas-lg { + --bs-offcanvas-height: auto; + --bs-offcanvas-border-width: 0; + background-color: transparent !important; } + .offcanvas-lg .offcanvas-header { + display: none; } + .offcanvas-lg .offcanvas-body { + display: flex; + flex-grow: 0; + padding: 0; + overflow-y: visible; + background-color: transparent !important; } } + +@media (max-width: 1199.98px) { + .offcanvas-xl { + position: fixed; + bottom: 0; + z-index: var(--bs-offcanvas-zindex); + display: flex; + flex-direction: column; + max-width: 100%; + color: var(--bs-offcanvas-color); + visibility: hidden; + background-color: var(--bs-offcanvas-bg); + background-clip: padding-box; + outline: 0; + transition: var(--bs-offcanvas-transition); } } + @media (max-width: 1199.98px) and (prefers-reduced-motion: reduce) { + .offcanvas-xl { + transition: none; } } +@media (max-width: 1199.98px) { + .offcanvas-xl.offcanvas-start { + top: 0; + left: 0; + width: var(--bs-offcanvas-width); + border-right: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateX(-100%); } + .offcanvas-xl.offcanvas-end { + top: 0; + right: 0; + width: var(--bs-offcanvas-width); + border-left: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateX(100%); } + .offcanvas-xl.offcanvas-top { + top: 0; + right: 0; + left: 0; + height: var(--bs-offcanvas-height); + max-height: 100%; + border-bottom: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateY(-100%); } + .offcanvas-xl.offcanvas-bottom { + right: 0; + left: 0; + height: var(--bs-offcanvas-height); + max-height: 100%; + border-top: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateY(100%); } + .offcanvas-xl.showing, .offcanvas-xl.show:not(.hiding) { + transform: none; } + .offcanvas-xl.showing, .offcanvas-xl.hiding, .offcanvas-xl.show { + visibility: visible; } } + +@media (min-width: 1200px) { + .offcanvas-xl { + --bs-offcanvas-height: auto; + --bs-offcanvas-border-width: 0; + background-color: transparent !important; } + .offcanvas-xl .offcanvas-header { + display: none; } + .offcanvas-xl .offcanvas-body { + display: flex; + flex-grow: 0; + padding: 0; + overflow-y: visible; + background-color: transparent !important; } } + +@media (max-width: 1399.98px) { + .offcanvas-xxl { + position: fixed; + bottom: 0; + z-index: var(--bs-offcanvas-zindex); + display: flex; + flex-direction: column; + max-width: 100%; + color: var(--bs-offcanvas-color); + visibility: hidden; + background-color: var(--bs-offcanvas-bg); + background-clip: padding-box; + outline: 0; + transition: var(--bs-offcanvas-transition); } } + @media (max-width: 1399.98px) and (prefers-reduced-motion: reduce) { + .offcanvas-xxl { + transition: none; } } +@media (max-width: 1399.98px) { + .offcanvas-xxl.offcanvas-start { + top: 0; + left: 0; + width: var(--bs-offcanvas-width); + border-right: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateX(-100%); } + .offcanvas-xxl.offcanvas-end { + top: 0; + right: 0; + width: var(--bs-offcanvas-width); + border-left: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateX(100%); } + .offcanvas-xxl.offcanvas-top { + top: 0; + right: 0; + left: 0; + height: var(--bs-offcanvas-height); + max-height: 100%; + border-bottom: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateY(-100%); } + .offcanvas-xxl.offcanvas-bottom { + right: 0; + left: 0; + height: var(--bs-offcanvas-height); + max-height: 100%; + border-top: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateY(100%); } + .offcanvas-xxl.showing, .offcanvas-xxl.show:not(.hiding) { + transform: none; } + .offcanvas-xxl.showing, .offcanvas-xxl.hiding, .offcanvas-xxl.show { + visibility: visible; } } + +@media (min-width: 1400px) { + .offcanvas-xxl { + --bs-offcanvas-height: auto; + --bs-offcanvas-border-width: 0; + background-color: transparent !important; } + .offcanvas-xxl .offcanvas-header { + display: none; } + .offcanvas-xxl .offcanvas-body { + display: flex; + flex-grow: 0; + padding: 0; + overflow-y: visible; + background-color: transparent !important; } } .offcanvas { position: fixed; bottom: 0; - z-index: 1045; + z-index: var(--bs-offcanvas-zindex); display: flex; flex-direction: column; max-width: 100%; + color: var(--bs-offcanvas-color); visibility: hidden; - background-color: #fff; + background-color: var(--bs-offcanvas-bg); background-clip: padding-box; outline: 0; - transition: transform 0.3s ease-in-out; } + transition: var(--bs-offcanvas-transition); } @media (prefers-reduced-motion: reduce) { .offcanvas { transition: none; } } + .offcanvas.offcanvas-start { + top: 0; + left: 0; + width: var(--bs-offcanvas-width); + border-right: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateX(-100%); } + .offcanvas.offcanvas-end { + top: 0; + right: 0; + width: var(--bs-offcanvas-width); + border-left: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateX(100%); } + .offcanvas.offcanvas-top { + top: 0; + right: 0; + left: 0; + height: var(--bs-offcanvas-height); + max-height: 100%; + border-bottom: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateY(-100%); } + .offcanvas.offcanvas-bottom { + right: 0; + left: 0; + height: var(--bs-offcanvas-height); + max-height: 100%; + border-top: var(--bs-offcanvas-border-width) solid var(--bs-offcanvas-border-color); + transform: translateY(100%); } + .offcanvas.showing, .offcanvas.show:not(.hiding) { + transform: none; } + .offcanvas.showing, .offcanvas.hiding, .offcanvas.show { + visibility: visible; } + .offcanvas-backdrop { position: fixed; top: 0; @@ -4760,63 +5518,26 @@ textarea.form-control-lg { .offcanvas-header { display: flex; align-items: center; - justify-content: space-between; - padding: 1rem 1rem; } + padding: var(--bs-offcanvas-padding-y) var(--bs-offcanvas-padding-x); } .offcanvas-header .btn-close { - padding: 0.5rem 0.5rem; - margin-top: -0.5rem; - margin-right: -0.5rem; - margin-bottom: -0.5rem; } + padding: calc(var(--bs-offcanvas-padding-y) * .5) calc(var(--bs-offcanvas-padding-x) * .5); + margin: calc(-.5 * var(--bs-offcanvas-padding-y)) calc(-.5 * var(--bs-offcanvas-padding-x)) calc(-.5 * var(--bs-offcanvas-padding-y)) auto; } .offcanvas-title { margin-bottom: 0; - line-height: 1.5; } + line-height: var(--bs-offcanvas-title-line-height); } .offcanvas-body { flex-grow: 1; - padding: 1rem 1rem; + padding: var(--bs-offcanvas-padding-y) var(--bs-offcanvas-padding-x); overflow-y: auto; } -.offcanvas-start { - top: 0; - left: 0; - width: 400px; - border-right: 1px solid rgba(0, 0, 0, 0.2); - transform: translateX(-100%); } - -.offcanvas-end { - top: 0; - right: 0; - width: 400px; - border-left: 1px solid rgba(0, 0, 0, 0.2); - transform: translateX(100%); } - -.offcanvas-top { - top: 0; - right: 0; - left: 0; - height: 30vh; - max-height: 100%; - border-bottom: 1px solid rgba(0, 0, 0, 0.2); - transform: translateY(-100%); } - -.offcanvas-bottom { - right: 0; - left: 0; - height: 30vh; - max-height: 100%; - border-top: 1px solid rgba(0, 0, 0, 0.2); - transform: translateY(100%); } - -.offcanvas.show { - transform: none; } - .placeholder { display: inline-block; min-height: 1em; vertical-align: middle; cursor: wait; - background-color: currentColor; + background-color: currentcolor; opacity: 0.5; } .placeholder.btn::before { display: inline-block; @@ -4852,45 +5573,123 @@ textarea.form-control-lg { clear: both; content: ""; } +.text-bg-primary { + color: #fff !important; + background-color: RGBA(var(--bs-primary-rgb), var(--bs-bg-opacity, 1)) !important; } + +.text-bg-secondary { + color: #fff !important; + background-color: RGBA(var(--bs-secondary-rgb), var(--bs-bg-opacity, 1)) !important; } + +.text-bg-success { + color: #fff !important; + background-color: RGBA(var(--bs-success-rgb), var(--bs-bg-opacity, 1)) !important; } + +.text-bg-info { + color: #000 !important; + background-color: RGBA(var(--bs-info-rgb), var(--bs-bg-opacity, 1)) !important; } + +.text-bg-warning { + color: #000 !important; + background-color: RGBA(var(--bs-warning-rgb), var(--bs-bg-opacity, 1)) !important; } + +.text-bg-danger { + color: #fff !important; + background-color: RGBA(var(--bs-danger-rgb), var(--bs-bg-opacity, 1)) !important; } + +.text-bg-light { + color: #000 !important; + background-color: RGBA(var(--bs-light-rgb), var(--bs-bg-opacity, 1)) !important; } + +.text-bg-dark { + color: #fff !important; + background-color: RGBA(var(--bs-dark-rgb), var(--bs-bg-opacity, 1)) !important; } + .link-primary { - color: #0d6efd; } + color: RGBA(var(--bs-primary-rgb), var(--bs-link-opacity, 1)) !important; + text-decoration-color: RGBA(var(--bs-primary-rgb), var(--bs-link-underline-opacity, 1)) !important; } .link-primary:hover, .link-primary:focus { - color: #0a58ca; } + color: RGBA(10, 88, 202, var(--bs-link-opacity, 1)) !important; + text-decoration-color: RGBA(10, 88, 202, var(--bs-link-underline-opacity, 1)) !important; } .link-secondary { - color: #6c757d; } + color: RGBA(var(--bs-secondary-rgb), var(--bs-link-opacity, 1)) !important; + text-decoration-color: RGBA(var(--bs-secondary-rgb), var(--bs-link-underline-opacity, 1)) !important; } .link-secondary:hover, .link-secondary:focus { - color: #565e64; } + color: RGBA(86, 94, 100, var(--bs-link-opacity, 1)) !important; + text-decoration-color: RGBA(86, 94, 100, var(--bs-link-underline-opacity, 1)) !important; } .link-success { - color: #198754; } + color: RGBA(var(--bs-success-rgb), var(--bs-link-opacity, 1)) !important; + text-decoration-color: RGBA(var(--bs-success-rgb), var(--bs-link-underline-opacity, 1)) !important; } .link-success:hover, .link-success:focus { - color: #146c43; } + color: RGBA(20, 108, 67, var(--bs-link-opacity, 1)) !important; + text-decoration-color: RGBA(20, 108, 67, var(--bs-link-underline-opacity, 1)) !important; } .link-info { - color: #0dcaf0; } + color: RGBA(var(--bs-info-rgb), var(--bs-link-opacity, 1)) !important; + text-decoration-color: RGBA(var(--bs-info-rgb), var(--bs-link-underline-opacity, 1)) !important; } .link-info:hover, .link-info:focus { - color: #3dd5f3; } + color: RGBA(61, 213, 243, var(--bs-link-opacity, 1)) !important; + text-decoration-color: RGBA(61, 213, 243, var(--bs-link-underline-opacity, 1)) !important; } .link-warning { - color: #ffc107; } + color: RGBA(var(--bs-warning-rgb), var(--bs-link-opacity, 1)) !important; + text-decoration-color: RGBA(var(--bs-warning-rgb), var(--bs-link-underline-opacity, 1)) !important; } .link-warning:hover, .link-warning:focus { - color: #ffcd39; } + color: RGBA(255, 205, 57, var(--bs-link-opacity, 1)) !important; + text-decoration-color: RGBA(255, 205, 57, var(--bs-link-underline-opacity, 1)) !important; } .link-danger { - color: #dc3545; } + color: RGBA(var(--bs-danger-rgb), var(--bs-link-opacity, 1)) !important; + text-decoration-color: RGBA(var(--bs-danger-rgb), var(--bs-link-underline-opacity, 1)) !important; } .link-danger:hover, .link-danger:focus { - color: #b02a37; } + color: RGBA(176, 42, 55, var(--bs-link-opacity, 1)) !important; + text-decoration-color: RGBA(176, 42, 55, var(--bs-link-underline-opacity, 1)) !important; } .link-light { - color: #f8f9fa; } + color: RGBA(var(--bs-light-rgb), var(--bs-link-opacity, 1)) !important; + text-decoration-color: RGBA(var(--bs-light-rgb), var(--bs-link-underline-opacity, 1)) !important; } .link-light:hover, .link-light:focus { - color: #f9fafb; } + color: RGBA(249, 250, 251, var(--bs-link-opacity, 1)) !important; + text-decoration-color: RGBA(249, 250, 251, var(--bs-link-underline-opacity, 1)) !important; } .link-dark { - color: #212529; } + color: RGBA(var(--bs-dark-rgb), var(--bs-link-opacity, 1)) !important; + text-decoration-color: RGBA(var(--bs-dark-rgb), var(--bs-link-underline-opacity, 1)) !important; } .link-dark:hover, .link-dark:focus { - color: #1a1e21; } + color: RGBA(26, 30, 33, var(--bs-link-opacity, 1)) !important; + text-decoration-color: RGBA(26, 30, 33, var(--bs-link-underline-opacity, 1)) !important; } + +.link-body-emphasis { + color: RGBA(var(--bs-emphasis-color-rgb), var(--bs-link-opacity, 1)) !important; + text-decoration-color: RGBA(var(--bs-emphasis-color-rgb), var(--bs-link-underline-opacity, 1)) !important; } + .link-body-emphasis:hover, .link-body-emphasis:focus { + color: RGBA(var(--bs-emphasis-color-rgb), var(--bs-link-opacity, 0.75)) !important; + text-decoration-color: RGBA(var(--bs-emphasis-color-rgb), var(--bs-link-underline-opacity, 0.75)) !important; } + +.focus-ring:focus { + outline: 0; + box-shadow: var(--bs-focus-ring-x, 0) var(--bs-focus-ring-y, 0) var(--bs-focus-ring-blur, 0) var(--bs-focus-ring-width) var(--bs-focus-ring-color); } + +.icon-link { + display: inline-flex; + gap: 0.375rem; + align-items: center; + text-decoration-color: rgba(var(--bs-link-color-rgb), var(--bs-link-opacity, 0.5)); + text-underline-offset: 0.25em; + backface-visibility: hidden; } + .icon-link > .bi { + flex-shrink: 0; + width: 1em; + height: 1em; + fill: currentcolor; + transition: 0.2s ease-in-out transform; } + @media (prefers-reduced-motion: reduce) { + .icon-link > .bi { + transition: none; } } +.icon-link-hover:hover > .bi, .icon-link-hover:focus-visible > .bi { + transform: var(--bs-icon-link-transform, translate3d(0.25em, 0, 0)); } .ratio { position: relative; @@ -4937,34 +5736,59 @@ textarea.form-control-lg { top: 0; z-index: 1020; } +.sticky-bottom { + position: sticky; + bottom: 0; + z-index: 1020; } + @media (min-width: 576px) { .sticky-sm-top { position: sticky; top: 0; + z-index: 1020; } + .sticky-sm-bottom { + position: sticky; + bottom: 0; z-index: 1020; } } @media (min-width: 768px) { .sticky-md-top { position: sticky; top: 0; + z-index: 1020; } + .sticky-md-bottom { + position: sticky; + bottom: 0; z-index: 1020; } } @media (min-width: 992px) { .sticky-lg-top { position: sticky; top: 0; + z-index: 1020; } + .sticky-lg-bottom { + position: sticky; + bottom: 0; z-index: 1020; } } @media (min-width: 1200px) { .sticky-xl-top { position: sticky; top: 0; + z-index: 1020; } + .sticky-xl-bottom { + position: sticky; + bottom: 0; z-index: 1020; } } @media (min-width: 1400px) { .sticky-xxl-top { position: sticky; top: 0; + z-index: 1020; } + .sticky-xxl-bottom { + position: sticky; + bottom: 0; z-index: 1020; } } .hstack { @@ -4981,7 +5805,6 @@ textarea.form-control-lg { .visually-hidden, .visually-hidden-focusable:not(:focus):not(:focus-within) { - position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; @@ -4990,6 +5813,9 @@ textarea.form-control-lg { clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; } + .visually-hidden:not(caption), + .visually-hidden-focusable:not(:focus):not(:focus-within):not(caption) { + position: absolute !important; } .stretched-link::after { position: absolute; @@ -5008,9 +5834,9 @@ textarea.form-control-lg { .vr { display: inline-block; align-self: stretch; - width: 1px; + width: var(--bs-border-width); min-height: 1em; - background-color: currentColor; + background-color: currentcolor; opacity: 0.25; } .align-baseline { @@ -5040,6 +5866,21 @@ textarea.form-control-lg { .float-none { float: none !important; } +.object-fit-contain { + object-fit: contain !important; } + +.object-fit-cover { + object-fit: cover !important; } + +.object-fit-fill { + object-fit: fill !important; } + +.object-fit-scale { + object-fit: scale-down !important; } + +.object-fit-none { + object-fit: none !important; } + .opacity-0 { opacity: 0 !important; } @@ -5067,6 +5908,30 @@ textarea.form-control-lg { .overflow-scroll { overflow: scroll !important; } +.overflow-x-auto { + overflow-x: auto !important; } + +.overflow-x-hidden { + overflow-x: hidden !important; } + +.overflow-x-visible { + overflow-x: visible !important; } + +.overflow-x-scroll { + overflow-x: scroll !important; } + +.overflow-y-auto { + overflow-y: auto !important; } + +.overflow-y-hidden { + overflow-y: hidden !important; } + +.overflow-y-visible { + overflow-y: visible !important; } + +.overflow-y-scroll { + overflow-y: scroll !important; } + .d-inline { display: inline !important; } @@ -5079,6 +5944,9 @@ textarea.form-control-lg { .d-grid { display: grid !important; } +.d-inline-grid { + display: inline-grid !important; } + .d-table { display: table !important; } @@ -5098,17 +5966,41 @@ textarea.form-control-lg { display: none !important; } .shadow { - box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important; } + box-shadow: var(--bs-box-shadow) !important; } .shadow-sm { - box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important; } + box-shadow: var(--bs-box-shadow-sm) !important; } .shadow-lg { - box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important; } + box-shadow: var(--bs-box-shadow-lg) !important; } .shadow-none { box-shadow: none !important; } +.focus-ring-primary { + --bs-focus-ring-color: rgba(var(--bs-primary-rgb), var(--bs-focus-ring-opacity)); } + +.focus-ring-secondary { + --bs-focus-ring-color: rgba(var(--bs-secondary-rgb), var(--bs-focus-ring-opacity)); } + +.focus-ring-success { + --bs-focus-ring-color: rgba(var(--bs-success-rgb), var(--bs-focus-ring-opacity)); } + +.focus-ring-info { + --bs-focus-ring-color: rgba(var(--bs-info-rgb), var(--bs-focus-ring-opacity)); } + +.focus-ring-warning { + --bs-focus-ring-color: rgba(var(--bs-warning-rgb), var(--bs-focus-ring-opacity)); } + +.focus-ring-danger { + --bs-focus-ring-color: rgba(var(--bs-danger-rgb), var(--bs-focus-ring-opacity)); } + +.focus-ring-light { + --bs-focus-ring-color: rgba(var(--bs-light-rgb), var(--bs-focus-ring-opacity)); } + +.focus-ring-dark { + --bs-focus-ring-color: rgba(var(--bs-dark-rgb), var(--bs-focus-ring-opacity)); } + .position-static { position: static !important; } @@ -5170,61 +6062,98 @@ textarea.form-control-lg { transform: translateY(-50%) !important; } .border { - border: 1px solid #dee2e6 !important; } + border: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color) !important; } .border-0 { border: 0 !important; } .border-top { - border-top: 1px solid #dee2e6 !important; } + border-top: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color) !important; } .border-top-0 { border-top: 0 !important; } .border-end { - border-right: 1px solid #dee2e6 !important; } + border-right: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color) !important; } .border-end-0 { border-right: 0 !important; } .border-bottom { - border-bottom: 1px solid #dee2e6 !important; } + border-bottom: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color) !important; } .border-bottom-0 { border-bottom: 0 !important; } .border-start { - border-left: 1px solid #dee2e6 !important; } + border-left: var(--bs-border-width) var(--bs-border-style) var(--bs-border-color) !important; } .border-start-0 { border-left: 0 !important; } .border-primary { - border-color: #0d6efd !important; } + --bs-border-opacity: 1; + border-color: rgba(var(--bs-primary-rgb), var(--bs-border-opacity)) !important; } .border-secondary { - border-color: #6c757d !important; } + --bs-border-opacity: 1; + border-color: rgba(var(--bs-secondary-rgb), var(--bs-border-opacity)) !important; } .border-success { - border-color: #198754 !important; } + --bs-border-opacity: 1; + border-color: rgba(var(--bs-success-rgb), var(--bs-border-opacity)) !important; } .border-info { - border-color: #0dcaf0 !important; } + --bs-border-opacity: 1; + border-color: rgba(var(--bs-info-rgb), var(--bs-border-opacity)) !important; } .border-warning { - border-color: #ffc107 !important; } + --bs-border-opacity: 1; + border-color: rgba(var(--bs-warning-rgb), var(--bs-border-opacity)) !important; } .border-danger { - border-color: #dc3545 !important; } + --bs-border-opacity: 1; + border-color: rgba(var(--bs-danger-rgb), var(--bs-border-opacity)) !important; } .border-light { - border-color: #f8f9fa !important; } + --bs-border-opacity: 1; + border-color: rgba(var(--bs-light-rgb), var(--bs-border-opacity)) !important; } .border-dark { - border-color: #212529 !important; } + --bs-border-opacity: 1; + border-color: rgba(var(--bs-dark-rgb), var(--bs-border-opacity)) !important; } + +.border-black { + --bs-border-opacity: 1; + border-color: rgba(var(--bs-black-rgb), var(--bs-border-opacity)) !important; } .border-white { - border-color: #fff !important; } + --bs-border-opacity: 1; + border-color: rgba(var(--bs-white-rgb), var(--bs-border-opacity)) !important; } + +.border-primary-subtle { + border-color: var(--bs-primary-border-subtle) !important; } + +.border-secondary-subtle { + border-color: var(--bs-secondary-border-subtle) !important; } + +.border-success-subtle { + border-color: var(--bs-success-border-subtle) !important; } + +.border-info-subtle { + border-color: var(--bs-info-border-subtle) !important; } + +.border-warning-subtle { + border-color: var(--bs-warning-border-subtle) !important; } + +.border-danger-subtle { + border-color: var(--bs-danger-border-subtle) !important; } + +.border-light-subtle { + border-color: var(--bs-light-border-subtle) !important; } + +.border-dark-subtle { + border-color: var(--bs-dark-border-subtle) !important; } .border-1 { border-width: 1px !important; } @@ -5241,6 +6170,21 @@ textarea.form-control-lg { .border-5 { border-width: 5px !important; } +.border-opacity-10 { + --bs-border-opacity: 0.1; } + +.border-opacity-25 { + --bs-border-opacity: 0.25; } + +.border-opacity-50 { + --bs-border-opacity: 0.5; } + +.border-opacity-75 { + --bs-border-opacity: 0.75; } + +.border-opacity-100 { + --bs-border-opacity: 1; } + .w-25 { width: 25% !important; } @@ -5325,24 +6269,6 @@ textarea.form-control-lg { .flex-wrap-reverse { flex-wrap: wrap-reverse !important; } -.gap-0 { - gap: 0 !important; } - -.gap-1 { - gap: 0.25rem !important; } - -.gap-2 { - gap: 0.5rem !important; } - -.gap-3 { - gap: 1rem !important; } - -.gap-4 { - gap: 1.5rem !important; } - -.gap-5 { - gap: 3rem !important; } - .justify-content-start { justify-content: flex-start !important; } @@ -5735,6 +6661,60 @@ textarea.form-control-lg { .ps-5 { padding-left: 3rem !important; } +.gap-0 { + gap: 0 !important; } + +.gap-1 { + gap: 0.25rem !important; } + +.gap-2 { + gap: 0.5rem !important; } + +.gap-3 { + gap: 1rem !important; } + +.gap-4 { + gap: 1.5rem !important; } + +.gap-5 { + gap: 3rem !important; } + +.row-gap-0 { + row-gap: 0 !important; } + +.row-gap-1 { + row-gap: 0.25rem !important; } + +.row-gap-2 { + row-gap: 0.5rem !important; } + +.row-gap-3 { + row-gap: 1rem !important; } + +.row-gap-4 { + row-gap: 1.5rem !important; } + +.row-gap-5 { + row-gap: 3rem !important; } + +.column-gap-0 { + column-gap: 0 !important; } + +.column-gap-1 { + column-gap: 0.25rem !important; } + +.column-gap-2 { + column-gap: 0.5rem !important; } + +.column-gap-3 { + column-gap: 1rem !important; } + +.column-gap-4 { + column-gap: 1.5rem !important; } + +.column-gap-5 { + column-gap: 3rem !important; } + .font-monospace { font-family: var(--bs-font-monospace) !important; } @@ -5762,15 +6742,21 @@ textarea.form-control-lg { .fst-normal { font-style: normal !important; } -.fw-light { - font-weight: 300 !important; } - .fw-lighter { font-weight: lighter !important; } +.fw-light { + font-weight: 300 !important; } + .fw-normal { font-weight: 400 !important; } +.fw-medium { + font-weight: 500 !important; } + +.fw-semibold { + font-weight: 600 !important; } + .fw-bold { font-weight: 700 !important; } @@ -5874,7 +6860,7 @@ textarea.form-control-lg { .text-muted { --bs-text-opacity: 1; - color: #6c757d !important; } + color: var(--bs-secondary-color) !important; } .text-black-50 { --bs-text-opacity: 1; @@ -5884,6 +6870,18 @@ textarea.form-control-lg { --bs-text-opacity: 1; color: rgba(255, 255, 255, 0.5) !important; } +.text-body-secondary { + --bs-text-opacity: 1; + color: var(--bs-secondary-color) !important; } + +.text-body-tertiary { + --bs-text-opacity: 1; + color: var(--bs-tertiary-color) !important; } + +.text-body-emphasis { + --bs-text-opacity: 1; + color: var(--bs-emphasis-color) !important; } + .text-reset { --bs-text-opacity: 1; color: inherit !important; } @@ -5900,6 +6898,150 @@ textarea.form-control-lg { .text-opacity-100 { --bs-text-opacity: 1; } +.text-primary-emphasis { + color: var(--bs-primary-text-emphasis) !important; } + +.text-secondary-emphasis { + color: var(--bs-secondary-text-emphasis) !important; } + +.text-success-emphasis { + color: var(--bs-success-text-emphasis) !important; } + +.text-info-emphasis { + color: var(--bs-info-text-emphasis) !important; } + +.text-warning-emphasis { + color: var(--bs-warning-text-emphasis) !important; } + +.text-danger-emphasis { + color: var(--bs-danger-text-emphasis) !important; } + +.text-light-emphasis { + color: var(--bs-light-text-emphasis) !important; } + +.text-dark-emphasis { + color: var(--bs-dark-text-emphasis) !important; } + +.link-opacity-10 { + --bs-link-opacity: 0.1; } + +.link-opacity-10-hover:hover { + --bs-link-opacity: 0.1; } + +.link-opacity-25 { + --bs-link-opacity: 0.25; } + +.link-opacity-25-hover:hover { + --bs-link-opacity: 0.25; } + +.link-opacity-50 { + --bs-link-opacity: 0.5; } + +.link-opacity-50-hover:hover { + --bs-link-opacity: 0.5; } + +.link-opacity-75 { + --bs-link-opacity: 0.75; } + +.link-opacity-75-hover:hover { + --bs-link-opacity: 0.75; } + +.link-opacity-100 { + --bs-link-opacity: 1; } + +.link-opacity-100-hover:hover { + --bs-link-opacity: 1; } + +.link-offset-1 { + text-underline-offset: 0.125em !important; } + +.link-offset-1-hover:hover { + text-underline-offset: 0.125em !important; } + +.link-offset-2 { + text-underline-offset: 0.25em !important; } + +.link-offset-2-hover:hover { + text-underline-offset: 0.25em !important; } + +.link-offset-3 { + text-underline-offset: 0.375em !important; } + +.link-offset-3-hover:hover { + text-underline-offset: 0.375em !important; } + +.link-underline-primary { + --bs-link-underline-opacity: 1; + text-decoration-color: rgba(var(--bs-primary-rgb), var(--bs-link-underline-opacity)) !important; } + +.link-underline-secondary { + --bs-link-underline-opacity: 1; + text-decoration-color: rgba(var(--bs-secondary-rgb), var(--bs-link-underline-opacity)) !important; } + +.link-underline-success { + --bs-link-underline-opacity: 1; + text-decoration-color: rgba(var(--bs-success-rgb), var(--bs-link-underline-opacity)) !important; } + +.link-underline-info { + --bs-link-underline-opacity: 1; + text-decoration-color: rgba(var(--bs-info-rgb), var(--bs-link-underline-opacity)) !important; } + +.link-underline-warning { + --bs-link-underline-opacity: 1; + text-decoration-color: rgba(var(--bs-warning-rgb), var(--bs-link-underline-opacity)) !important; } + +.link-underline-danger { + --bs-link-underline-opacity: 1; + text-decoration-color: rgba(var(--bs-danger-rgb), var(--bs-link-underline-opacity)) !important; } + +.link-underline-light { + --bs-link-underline-opacity: 1; + text-decoration-color: rgba(var(--bs-light-rgb), var(--bs-link-underline-opacity)) !important; } + +.link-underline-dark { + --bs-link-underline-opacity: 1; + text-decoration-color: rgba(var(--bs-dark-rgb), var(--bs-link-underline-opacity)) !important; } + +.link-underline { + --bs-link-underline-opacity: 1; + text-decoration-color: rgba(var(--bs-link-color-rgb), var(--bs-link-underline-opacity, 1)) !important; } + +.link-underline-opacity-0 { + --bs-link-underline-opacity: 0; } + +.link-underline-opacity-0-hover:hover { + --bs-link-underline-opacity: 0; } + +.link-underline-opacity-10 { + --bs-link-underline-opacity: 0.1; } + +.link-underline-opacity-10-hover:hover { + --bs-link-underline-opacity: 0.1; } + +.link-underline-opacity-25 { + --bs-link-underline-opacity: 0.25; } + +.link-underline-opacity-25-hover:hover { + --bs-link-underline-opacity: 0.25; } + +.link-underline-opacity-50 { + --bs-link-underline-opacity: 0.5; } + +.link-underline-opacity-50-hover:hover { + --bs-link-underline-opacity: 0.5; } + +.link-underline-opacity-75 { + --bs-link-underline-opacity: 0.75; } + +.link-underline-opacity-75-hover:hover { + --bs-link-underline-opacity: 0.75; } + +.link-underline-opacity-100 { + --bs-link-underline-opacity: 1; } + +.link-underline-opacity-100-hover:hover { + --bs-link-underline-opacity: 1; } + .bg-primary { --bs-bg-opacity: 1; background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity)) !important; } @@ -5948,6 +7090,14 @@ textarea.form-control-lg { --bs-bg-opacity: 1; background-color: transparent !important; } +.bg-body-secondary { + --bs-bg-opacity: 1; + background-color: rgba(var(--bs-secondary-bg-rgb), var(--bs-bg-opacity)) !important; } + +.bg-body-tertiary { + --bs-bg-opacity: 1; + background-color: rgba(var(--bs-tertiary-bg-rgb), var(--bs-bg-opacity)) !important; } + .bg-opacity-10 { --bs-bg-opacity: 0.1; } @@ -5963,6 +7113,30 @@ textarea.form-control-lg { .bg-opacity-100 { --bs-bg-opacity: 1; } +.bg-primary-subtle { + background-color: var(--bs-primary-bg-subtle) !important; } + +.bg-secondary-subtle { + background-color: var(--bs-secondary-bg-subtle) !important; } + +.bg-success-subtle { + background-color: var(--bs-success-bg-subtle) !important; } + +.bg-info-subtle { + background-color: var(--bs-info-bg-subtle) !important; } + +.bg-warning-subtle { + background-color: var(--bs-warning-bg-subtle) !important; } + +.bg-danger-subtle { + background-color: var(--bs-danger-bg-subtle) !important; } + +.bg-light-subtle { + background-color: var(--bs-light-bg-subtle) !important; } + +.bg-dark-subtle { + background-color: var(--bs-dark-bg-subtle) !important; } + .bg-gradient { background-image: var(--bs-gradient) !important; } @@ -5982,41 +7156,175 @@ textarea.form-control-lg { pointer-events: auto !important; } .rounded { - border-radius: 0.25rem !important; } + border-radius: var(--bs-border-radius) !important; } .rounded-0 { border-radius: 0 !important; } .rounded-1 { - border-radius: 0.2rem !important; } + border-radius: var(--bs-border-radius-sm) !important; } .rounded-2 { - border-radius: 0.25rem !important; } + border-radius: var(--bs-border-radius) !important; } .rounded-3 { - border-radius: 0.3rem !important; } + border-radius: var(--bs-border-radius-lg) !important; } + +.rounded-4 { + border-radius: var(--bs-border-radius-xl) !important; } + +.rounded-5 { + border-radius: var(--bs-border-radius-xxl) !important; } .rounded-circle { border-radius: 50% !important; } .rounded-pill { - border-radius: 50rem !important; } + border-radius: var(--bs-border-radius-pill) !important; } .rounded-top { - border-top-left-radius: 0.25rem !important; - border-top-right-radius: 0.25rem !important; } + border-top-left-radius: var(--bs-border-radius) !important; + border-top-right-radius: var(--bs-border-radius) !important; } + +.rounded-top-0 { + border-top-left-radius: 0 !important; + border-top-right-radius: 0 !important; } + +.rounded-top-1 { + border-top-left-radius: var(--bs-border-radius-sm) !important; + border-top-right-radius: var(--bs-border-radius-sm) !important; } + +.rounded-top-2 { + border-top-left-radius: var(--bs-border-radius) !important; + border-top-right-radius: var(--bs-border-radius) !important; } + +.rounded-top-3 { + border-top-left-radius: var(--bs-border-radius-lg) !important; + border-top-right-radius: var(--bs-border-radius-lg) !important; } + +.rounded-top-4 { + border-top-left-radius: var(--bs-border-radius-xl) !important; + border-top-right-radius: var(--bs-border-radius-xl) !important; } + +.rounded-top-5 { + border-top-left-radius: var(--bs-border-radius-xxl) !important; + border-top-right-radius: var(--bs-border-radius-xxl) !important; } + +.rounded-top-circle { + border-top-left-radius: 50% !important; + border-top-right-radius: 50% !important; } + +.rounded-top-pill { + border-top-left-radius: var(--bs-border-radius-pill) !important; + border-top-right-radius: var(--bs-border-radius-pill) !important; } .rounded-end { - border-top-right-radius: 0.25rem !important; - border-bottom-right-radius: 0.25rem !important; } + border-top-right-radius: var(--bs-border-radius) !important; + border-bottom-right-radius: var(--bs-border-radius) !important; } + +.rounded-end-0 { + border-top-right-radius: 0 !important; + border-bottom-right-radius: 0 !important; } + +.rounded-end-1 { + border-top-right-radius: var(--bs-border-radius-sm) !important; + border-bottom-right-radius: var(--bs-border-radius-sm) !important; } + +.rounded-end-2 { + border-top-right-radius: var(--bs-border-radius) !important; + border-bottom-right-radius: var(--bs-border-radius) !important; } + +.rounded-end-3 { + border-top-right-radius: var(--bs-border-radius-lg) !important; + border-bottom-right-radius: var(--bs-border-radius-lg) !important; } + +.rounded-end-4 { + border-top-right-radius: var(--bs-border-radius-xl) !important; + border-bottom-right-radius: var(--bs-border-radius-xl) !important; } + +.rounded-end-5 { + border-top-right-radius: var(--bs-border-radius-xxl) !important; + border-bottom-right-radius: var(--bs-border-radius-xxl) !important; } + +.rounded-end-circle { + border-top-right-radius: 50% !important; + border-bottom-right-radius: 50% !important; } + +.rounded-end-pill { + border-top-right-radius: var(--bs-border-radius-pill) !important; + border-bottom-right-radius: var(--bs-border-radius-pill) !important; } .rounded-bottom { - border-bottom-right-radius: 0.25rem !important; - border-bottom-left-radius: 0.25rem !important; } + border-bottom-right-radius: var(--bs-border-radius) !important; + border-bottom-left-radius: var(--bs-border-radius) !important; } + +.rounded-bottom-0 { + border-bottom-right-radius: 0 !important; + border-bottom-left-radius: 0 !important; } + +.rounded-bottom-1 { + border-bottom-right-radius: var(--bs-border-radius-sm) !important; + border-bottom-left-radius: var(--bs-border-radius-sm) !important; } + +.rounded-bottom-2 { + border-bottom-right-radius: var(--bs-border-radius) !important; + border-bottom-left-radius: var(--bs-border-radius) !important; } + +.rounded-bottom-3 { + border-bottom-right-radius: var(--bs-border-radius-lg) !important; + border-bottom-left-radius: var(--bs-border-radius-lg) !important; } + +.rounded-bottom-4 { + border-bottom-right-radius: var(--bs-border-radius-xl) !important; + border-bottom-left-radius: var(--bs-border-radius-xl) !important; } + +.rounded-bottom-5 { + border-bottom-right-radius: var(--bs-border-radius-xxl) !important; + border-bottom-left-radius: var(--bs-border-radius-xxl) !important; } + +.rounded-bottom-circle { + border-bottom-right-radius: 50% !important; + border-bottom-left-radius: 50% !important; } + +.rounded-bottom-pill { + border-bottom-right-radius: var(--bs-border-radius-pill) !important; + border-bottom-left-radius: var(--bs-border-radius-pill) !important; } .rounded-start { - border-bottom-left-radius: 0.25rem !important; - border-top-left-radius: 0.25rem !important; } + border-bottom-left-radius: var(--bs-border-radius) !important; + border-top-left-radius: var(--bs-border-radius) !important; } + +.rounded-start-0 { + border-bottom-left-radius: 0 !important; + border-top-left-radius: 0 !important; } + +.rounded-start-1 { + border-bottom-left-radius: var(--bs-border-radius-sm) !important; + border-top-left-radius: var(--bs-border-radius-sm) !important; } + +.rounded-start-2 { + border-bottom-left-radius: var(--bs-border-radius) !important; + border-top-left-radius: var(--bs-border-radius) !important; } + +.rounded-start-3 { + border-bottom-left-radius: var(--bs-border-radius-lg) !important; + border-top-left-radius: var(--bs-border-radius-lg) !important; } + +.rounded-start-4 { + border-bottom-left-radius: var(--bs-border-radius-xl) !important; + border-top-left-radius: var(--bs-border-radius-xl) !important; } + +.rounded-start-5 { + border-bottom-left-radius: var(--bs-border-radius-xxl) !important; + border-top-left-radius: var(--bs-border-radius-xxl) !important; } + +.rounded-start-circle { + border-bottom-left-radius: 50% !important; + border-top-left-radius: 50% !important; } + +.rounded-start-pill { + border-bottom-left-radius: var(--bs-border-radius-pill) !important; + border-top-left-radius: var(--bs-border-radius-pill) !important; } .visible { visibility: visible !important; } @@ -6024,6 +7332,21 @@ textarea.form-control-lg { .invisible { visibility: hidden !important; } +.z-n1 { + z-index: -1 !important; } + +.z-0 { + z-index: 0 !important; } + +.z-1 { + z-index: 1 !important; } + +.z-2 { + z-index: 2 !important; } + +.z-3 { + z-index: 3 !important; } + @media (min-width: 576px) { .float-sm-start { float: left !important; } @@ -6031,6 +7354,16 @@ textarea.form-control-lg { float: right !important; } .float-sm-none { float: none !important; } + .object-fit-sm-contain { + object-fit: contain !important; } + .object-fit-sm-cover { + object-fit: cover !important; } + .object-fit-sm-fill { + object-fit: fill !important; } + .object-fit-sm-scale { + object-fit: scale-down !important; } + .object-fit-sm-none { + object-fit: none !important; } .d-sm-inline { display: inline !important; } .d-sm-inline-block { @@ -6039,6 +7372,8 @@ textarea.form-control-lg { display: block !important; } .d-sm-grid { display: grid !important; } + .d-sm-inline-grid { + display: inline-grid !important; } .d-sm-table { display: table !important; } .d-sm-table-row { @@ -6075,18 +7410,6 @@ textarea.form-control-lg { flex-wrap: nowrap !important; } .flex-sm-wrap-reverse { flex-wrap: wrap-reverse !important; } - .gap-sm-0 { - gap: 0 !important; } - .gap-sm-1 { - gap: 0.25rem !important; } - .gap-sm-2 { - gap: 0.5rem !important; } - .gap-sm-3 { - gap: 1rem !important; } - .gap-sm-4 { - gap: 1.5rem !important; } - .gap-sm-5 { - gap: 3rem !important; } .justify-content-sm-start { justify-content: flex-start !important; } .justify-content-sm-end { @@ -6357,6 +7680,42 @@ textarea.form-control-lg { padding-left: 1.5rem !important; } .ps-sm-5 { padding-left: 3rem !important; } + .gap-sm-0 { + gap: 0 !important; } + .gap-sm-1 { + gap: 0.25rem !important; } + .gap-sm-2 { + gap: 0.5rem !important; } + .gap-sm-3 { + gap: 1rem !important; } + .gap-sm-4 { + gap: 1.5rem !important; } + .gap-sm-5 { + gap: 3rem !important; } + .row-gap-sm-0 { + row-gap: 0 !important; } + .row-gap-sm-1 { + row-gap: 0.25rem !important; } + .row-gap-sm-2 { + row-gap: 0.5rem !important; } + .row-gap-sm-3 { + row-gap: 1rem !important; } + .row-gap-sm-4 { + row-gap: 1.5rem !important; } + .row-gap-sm-5 { + row-gap: 3rem !important; } + .column-gap-sm-0 { + column-gap: 0 !important; } + .column-gap-sm-1 { + column-gap: 0.25rem !important; } + .column-gap-sm-2 { + column-gap: 0.5rem !important; } + .column-gap-sm-3 { + column-gap: 1rem !important; } + .column-gap-sm-4 { + column-gap: 1.5rem !important; } + .column-gap-sm-5 { + column-gap: 3rem !important; } .text-sm-start { text-align: left !important; } .text-sm-end { @@ -6371,6 +7730,16 @@ textarea.form-control-lg { float: right !important; } .float-md-none { float: none !important; } + .object-fit-md-contain { + object-fit: contain !important; } + .object-fit-md-cover { + object-fit: cover !important; } + .object-fit-md-fill { + object-fit: fill !important; } + .object-fit-md-scale { + object-fit: scale-down !important; } + .object-fit-md-none { + object-fit: none !important; } .d-md-inline { display: inline !important; } .d-md-inline-block { @@ -6379,6 +7748,8 @@ textarea.form-control-lg { display: block !important; } .d-md-grid { display: grid !important; } + .d-md-inline-grid { + display: inline-grid !important; } .d-md-table { display: table !important; } .d-md-table-row { @@ -6415,18 +7786,6 @@ textarea.form-control-lg { flex-wrap: nowrap !important; } .flex-md-wrap-reverse { flex-wrap: wrap-reverse !important; } - .gap-md-0 { - gap: 0 !important; } - .gap-md-1 { - gap: 0.25rem !important; } - .gap-md-2 { - gap: 0.5rem !important; } - .gap-md-3 { - gap: 1rem !important; } - .gap-md-4 { - gap: 1.5rem !important; } - .gap-md-5 { - gap: 3rem !important; } .justify-content-md-start { justify-content: flex-start !important; } .justify-content-md-end { @@ -6697,6 +8056,42 @@ textarea.form-control-lg { padding-left: 1.5rem !important; } .ps-md-5 { padding-left: 3rem !important; } + .gap-md-0 { + gap: 0 !important; } + .gap-md-1 { + gap: 0.25rem !important; } + .gap-md-2 { + gap: 0.5rem !important; } + .gap-md-3 { + gap: 1rem !important; } + .gap-md-4 { + gap: 1.5rem !important; } + .gap-md-5 { + gap: 3rem !important; } + .row-gap-md-0 { + row-gap: 0 !important; } + .row-gap-md-1 { + row-gap: 0.25rem !important; } + .row-gap-md-2 { + row-gap: 0.5rem !important; } + .row-gap-md-3 { + row-gap: 1rem !important; } + .row-gap-md-4 { + row-gap: 1.5rem !important; } + .row-gap-md-5 { + row-gap: 3rem !important; } + .column-gap-md-0 { + column-gap: 0 !important; } + .column-gap-md-1 { + column-gap: 0.25rem !important; } + .column-gap-md-2 { + column-gap: 0.5rem !important; } + .column-gap-md-3 { + column-gap: 1rem !important; } + .column-gap-md-4 { + column-gap: 1.5rem !important; } + .column-gap-md-5 { + column-gap: 3rem !important; } .text-md-start { text-align: left !important; } .text-md-end { @@ -6711,6 +8106,16 @@ textarea.form-control-lg { float: right !important; } .float-lg-none { float: none !important; } + .object-fit-lg-contain { + object-fit: contain !important; } + .object-fit-lg-cover { + object-fit: cover !important; } + .object-fit-lg-fill { + object-fit: fill !important; } + .object-fit-lg-scale { + object-fit: scale-down !important; } + .object-fit-lg-none { + object-fit: none !important; } .d-lg-inline { display: inline !important; } .d-lg-inline-block { @@ -6719,6 +8124,8 @@ textarea.form-control-lg { display: block !important; } .d-lg-grid { display: grid !important; } + .d-lg-inline-grid { + display: inline-grid !important; } .d-lg-table { display: table !important; } .d-lg-table-row { @@ -6755,18 +8162,6 @@ textarea.form-control-lg { flex-wrap: nowrap !important; } .flex-lg-wrap-reverse { flex-wrap: wrap-reverse !important; } - .gap-lg-0 { - gap: 0 !important; } - .gap-lg-1 { - gap: 0.25rem !important; } - .gap-lg-2 { - gap: 0.5rem !important; } - .gap-lg-3 { - gap: 1rem !important; } - .gap-lg-4 { - gap: 1.5rem !important; } - .gap-lg-5 { - gap: 3rem !important; } .justify-content-lg-start { justify-content: flex-start !important; } .justify-content-lg-end { @@ -7037,6 +8432,42 @@ textarea.form-control-lg { padding-left: 1.5rem !important; } .ps-lg-5 { padding-left: 3rem !important; } + .gap-lg-0 { + gap: 0 !important; } + .gap-lg-1 { + gap: 0.25rem !important; } + .gap-lg-2 { + gap: 0.5rem !important; } + .gap-lg-3 { + gap: 1rem !important; } + .gap-lg-4 { + gap: 1.5rem !important; } + .gap-lg-5 { + gap: 3rem !important; } + .row-gap-lg-0 { + row-gap: 0 !important; } + .row-gap-lg-1 { + row-gap: 0.25rem !important; } + .row-gap-lg-2 { + row-gap: 0.5rem !important; } + .row-gap-lg-3 { + row-gap: 1rem !important; } + .row-gap-lg-4 { + row-gap: 1.5rem !important; } + .row-gap-lg-5 { + row-gap: 3rem !important; } + .column-gap-lg-0 { + column-gap: 0 !important; } + .column-gap-lg-1 { + column-gap: 0.25rem !important; } + .column-gap-lg-2 { + column-gap: 0.5rem !important; } + .column-gap-lg-3 { + column-gap: 1rem !important; } + .column-gap-lg-4 { + column-gap: 1.5rem !important; } + .column-gap-lg-5 { + column-gap: 3rem !important; } .text-lg-start { text-align: left !important; } .text-lg-end { @@ -7051,6 +8482,16 @@ textarea.form-control-lg { float: right !important; } .float-xl-none { float: none !important; } + .object-fit-xl-contain { + object-fit: contain !important; } + .object-fit-xl-cover { + object-fit: cover !important; } + .object-fit-xl-fill { + object-fit: fill !important; } + .object-fit-xl-scale { + object-fit: scale-down !important; } + .object-fit-xl-none { + object-fit: none !important; } .d-xl-inline { display: inline !important; } .d-xl-inline-block { @@ -7059,6 +8500,8 @@ textarea.form-control-lg { display: block !important; } .d-xl-grid { display: grid !important; } + .d-xl-inline-grid { + display: inline-grid !important; } .d-xl-table { display: table !important; } .d-xl-table-row { @@ -7095,18 +8538,6 @@ textarea.form-control-lg { flex-wrap: nowrap !important; } .flex-xl-wrap-reverse { flex-wrap: wrap-reverse !important; } - .gap-xl-0 { - gap: 0 !important; } - .gap-xl-1 { - gap: 0.25rem !important; } - .gap-xl-2 { - gap: 0.5rem !important; } - .gap-xl-3 { - gap: 1rem !important; } - .gap-xl-4 { - gap: 1.5rem !important; } - .gap-xl-5 { - gap: 3rem !important; } .justify-content-xl-start { justify-content: flex-start !important; } .justify-content-xl-end { @@ -7377,6 +8808,42 @@ textarea.form-control-lg { padding-left: 1.5rem !important; } .ps-xl-5 { padding-left: 3rem !important; } + .gap-xl-0 { + gap: 0 !important; } + .gap-xl-1 { + gap: 0.25rem !important; } + .gap-xl-2 { + gap: 0.5rem !important; } + .gap-xl-3 { + gap: 1rem !important; } + .gap-xl-4 { + gap: 1.5rem !important; } + .gap-xl-5 { + gap: 3rem !important; } + .row-gap-xl-0 { + row-gap: 0 !important; } + .row-gap-xl-1 { + row-gap: 0.25rem !important; } + .row-gap-xl-2 { + row-gap: 0.5rem !important; } + .row-gap-xl-3 { + row-gap: 1rem !important; } + .row-gap-xl-4 { + row-gap: 1.5rem !important; } + .row-gap-xl-5 { + row-gap: 3rem !important; } + .column-gap-xl-0 { + column-gap: 0 !important; } + .column-gap-xl-1 { + column-gap: 0.25rem !important; } + .column-gap-xl-2 { + column-gap: 0.5rem !important; } + .column-gap-xl-3 { + column-gap: 1rem !important; } + .column-gap-xl-4 { + column-gap: 1.5rem !important; } + .column-gap-xl-5 { + column-gap: 3rem !important; } .text-xl-start { text-align: left !important; } .text-xl-end { @@ -7391,6 +8858,16 @@ textarea.form-control-lg { float: right !important; } .float-xxl-none { float: none !important; } + .object-fit-xxl-contain { + object-fit: contain !important; } + .object-fit-xxl-cover { + object-fit: cover !important; } + .object-fit-xxl-fill { + object-fit: fill !important; } + .object-fit-xxl-scale { + object-fit: scale-down !important; } + .object-fit-xxl-none { + object-fit: none !important; } .d-xxl-inline { display: inline !important; } .d-xxl-inline-block { @@ -7399,6 +8876,8 @@ textarea.form-control-lg { display: block !important; } .d-xxl-grid { display: grid !important; } + .d-xxl-inline-grid { + display: inline-grid !important; } .d-xxl-table { display: table !important; } .d-xxl-table-row { @@ -7435,18 +8914,6 @@ textarea.form-control-lg { flex-wrap: nowrap !important; } .flex-xxl-wrap-reverse { flex-wrap: wrap-reverse !important; } - .gap-xxl-0 { - gap: 0 !important; } - .gap-xxl-1 { - gap: 0.25rem !important; } - .gap-xxl-2 { - gap: 0.5rem !important; } - .gap-xxl-3 { - gap: 1rem !important; } - .gap-xxl-4 { - gap: 1.5rem !important; } - .gap-xxl-5 { - gap: 3rem !important; } .justify-content-xxl-start { justify-content: flex-start !important; } .justify-content-xxl-end { @@ -7717,6 +9184,42 @@ textarea.form-control-lg { padding-left: 1.5rem !important; } .ps-xxl-5 { padding-left: 3rem !important; } + .gap-xxl-0 { + gap: 0 !important; } + .gap-xxl-1 { + gap: 0.25rem !important; } + .gap-xxl-2 { + gap: 0.5rem !important; } + .gap-xxl-3 { + gap: 1rem !important; } + .gap-xxl-4 { + gap: 1.5rem !important; } + .gap-xxl-5 { + gap: 3rem !important; } + .row-gap-xxl-0 { + row-gap: 0 !important; } + .row-gap-xxl-1 { + row-gap: 0.25rem !important; } + .row-gap-xxl-2 { + row-gap: 0.5rem !important; } + .row-gap-xxl-3 { + row-gap: 1rem !important; } + .row-gap-xxl-4 { + row-gap: 1.5rem !important; } + .row-gap-xxl-5 { + row-gap: 3rem !important; } + .column-gap-xxl-0 { + column-gap: 0 !important; } + .column-gap-xxl-1 { + column-gap: 0.25rem !important; } + .column-gap-xxl-2 { + column-gap: 0.5rem !important; } + .column-gap-xxl-3 { + column-gap: 1rem !important; } + .column-gap-xxl-4 { + column-gap: 1.5rem !important; } + .column-gap-xxl-5 { + column-gap: 3rem !important; } .text-xxl-start { text-align: left !important; } .text-xxl-end { @@ -7743,6 +9246,8 @@ textarea.form-control-lg { display: block !important; } .d-print-grid { display: grid !important; } + .d-print-inline-grid { + display: inline-grid !important; } .d-print-table { display: table !important; } .d-print-table-row { @@ -7865,6 +9370,9 @@ table td.action-column { .status-help-content-table td { color: #34302D; } +.logo { + width: 200px; } + .myspinner { animation-name: spinner; animation-duration: 2s; diff --git a/src/main/resources/static/resources/images/platform-bg.png b/src/main/resources/static/resources/images/platform-bg.png deleted file mode 100644 index 5121858..0000000 Binary files a/src/main/resources/static/resources/images/platform-bg.png and /dev/null differ diff --git a/src/main/resources/static/resources/images/spring-logo.svg b/src/main/resources/static/resources/images/spring-logo.svg new file mode 100644 index 0000000..5b2a27a --- /dev/null +++ b/src/main/resources/static/resources/images/spring-logo.svg @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/static/resources/images/spring-pivotal-logo.png b/src/main/resources/static/resources/images/spring-pivotal-logo.png deleted file mode 100644 index 1840af2..0000000 Binary files a/src/main/resources/static/resources/images/spring-pivotal-logo.png and /dev/null differ diff --git a/src/main/resources/templates/fragments/layout.html b/src/main/resources/templates/fragments/layout.html old mode 100755 new mode 100644 index 5c8d391..eb54d28 --- a/src/main/resources/templates/fragments/layout.html +++ b/src/main/resources/templates/fragments/layout.html @@ -17,7 +17,7 @@ - + @@ -80,14 +80,14 @@
- Sponsored by Pivotal
+ +
- + diff --git a/src/main/resources/templates/owners/ownerDetails.html b/src/main/resources/templates/owners/ownerDetails.html index 41f7d16..15bca4a 100644 --- a/src/main/resources/templates/owners/ownerDetails.html +++ b/src/main/resources/templates/owners/ownerDetails.html @@ -7,8 +7,18 @@

Owner Information

- - + +
+ +
+ +
+ +
+ + + + @@ -73,7 +83,20 @@
Name
- + + + diff --git a/src/main/scss/petclinic.scss b/src/main/scss/petclinic.scss index febc6ee..7f3e64e 100644 --- a/src/main/scss/petclinic.scss +++ b/src/main/scss/petclinic.scss @@ -188,6 +188,10 @@ table td.action-column { color: $spring-brown; } +.logo { + width: 200px; +} + .myspinner { animation-name: spinner; animation-duration: 2s; diff --git a/src/test/java/org/springframework/samples/petclinic/MySqlIntegrationTests.java b/src/test/java/org/springframework/samples/petclinic/MySqlIntegrationTests.java new file mode 100644 index 0000000..d67e449 --- /dev/null +++ b/src/test/java/org/springframework/samples/petclinic/MySqlIntegrationTests.java @@ -0,0 +1,73 @@ +/* + * Copyright 2012-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.samples.petclinic; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledInNativeImage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.boot.test.web.server.LocalServerPort; +import org.springframework.boot.testcontainers.service.connection.ServiceConnection; +import org.springframework.boot.web.client.RestTemplateBuilder; +import org.springframework.http.HttpStatus; +import org.springframework.http.RequestEntity; +import org.springframework.http.ResponseEntity; +import org.springframework.samples.petclinic.vet.VetRepository; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.aot.DisabledInAotMode; +import org.springframework.web.client.RestTemplate; +import org.testcontainers.containers.MySQLContainer; +import org.testcontainers.junit.jupiter.Container; +import org.testcontainers.junit.jupiter.Testcontainers; + +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@ActiveProfiles("mysql") +@Testcontainers(disabledWithoutDocker = true) +@DisabledInNativeImage +@DisabledInAotMode +class MySqlIntegrationTests { + + @ServiceConnection + @Container + static MySQLContainer container = new MySQLContainer<>("mysql:9.1"); + + @LocalServerPort + int port; + + @Autowired + private VetRepository vets; + + @Autowired + private RestTemplateBuilder builder; + + @Test + void testFindAll() { + vets.findAll(); + vets.findAll(); // served from cache + } + + @Test + void testOwnerDetails() { + RestTemplate template = builder.rootUri("http://localhost:" + port).build(); + ResponseEntity result = template.exchange(RequestEntity.get("/owners/1").build(), String.class); + assertThat(result.getStatusCode()).isEqualTo(HttpStatus.OK); + } + +} diff --git a/src/test/java/org/springframework/samples/petclinic/MysqlTestApplication.java b/src/test/java/org/springframework/samples/petclinic/MysqlTestApplication.java new file mode 100644 index 0000000..8c7560a --- /dev/null +++ b/src/test/java/org/springframework/samples/petclinic/MysqlTestApplication.java @@ -0,0 +1,46 @@ +/* + * Copyright 2012-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.samples.petclinic; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.testcontainers.service.connection.ServiceConnection; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import org.testcontainers.containers.MySQLContainer; + +/** + * PetClinic Spring Boot Application. + * + * @author Dave Syer + * + */ +@Configuration +public class MysqlTestApplication { + + @ServiceConnection + @Profile("mysql") + @Bean + static MySQLContainer container() { + return new MySQLContainer<>("mysql:9.1"); + } + + public static void main(String[] args) { + SpringApplication.run(PetClinicApplication.class, "--spring.profiles.active=mysql"); + } + +} diff --git a/src/test/java/org/springframework/samples/petclinic/PetClinicIntegrationTests.java b/src/test/java/org/springframework/samples/petclinic/PetClinicIntegrationTests.java index 3bf1c0c..6d98206 100644 --- a/src/test/java/org/springframework/samples/petclinic/PetClinicIntegrationTests.java +++ b/src/test/java/org/springframework/samples/petclinic/PetClinicIntegrationTests.java @@ -20,6 +20,7 @@ import static org.assertj.core.api.Assertions.assertThat; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.SpringApplication; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.server.LocalServerPort; @@ -31,7 +32,7 @@ import org.springframework.samples.petclinic.vet.VetRepository; import org.springframework.web.client.RestTemplate; @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) -class PetClinicIntegrationTests { +public class PetClinicIntegrationTests { @LocalServerPort int port; @@ -43,7 +44,7 @@ class PetClinicIntegrationTests { private RestTemplateBuilder builder; @Test - void testFindAll() throws Exception { + void testFindAll() { vets.findAll(); vets.findAll(); // served from cache } @@ -55,4 +56,8 @@ class PetClinicIntegrationTests { assertThat(result.getStatusCode()).isEqualTo(HttpStatus.OK); } + public static void main(String[] args) { + SpringApplication.run(PetClinicApplication.class, args); + } + } diff --git a/src/test/java/org/springframework/samples/petclinic/PostgresIntegrationTests.java b/src/test/java/org/springframework/samples/petclinic/PostgresIntegrationTests.java new file mode 100644 index 0000000..0b9e4f9 --- /dev/null +++ b/src/test/java/org/springframework/samples/petclinic/PostgresIntegrationTests.java @@ -0,0 +1,150 @@ +/* + * Copyright 2012-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.samples.petclinic; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assumptions.assumeTrue; + +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledInNativeImage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.context.event.ApplicationPreparedEvent; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.boot.test.web.server.LocalServerPort; +import org.springframework.boot.web.client.RestTemplateBuilder; +import org.springframework.context.ApplicationListener; +import org.springframework.core.env.ConfigurableEnvironment; +import org.springframework.core.env.EnumerablePropertySource; +import org.springframework.core.env.PropertySource; +import org.springframework.http.HttpStatus; +import org.springframework.http.RequestEntity; +import org.springframework.http.ResponseEntity; +import org.springframework.samples.petclinic.vet.VetRepository; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.web.client.RestTemplate; +import org.testcontainers.DockerClientFactory; + +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "spring.docker.compose.skip.in-tests=false", // + "spring.docker.compose.start.arguments=--force-recreate,--renew-anon-volumes,postgres" }) +@ActiveProfiles("postgres") +@DisabledInNativeImage +public class PostgresIntegrationTests { + + @LocalServerPort + int port; + + @Autowired + private VetRepository vets; + + @Autowired + private RestTemplateBuilder builder; + + @BeforeAll + static void available() { + assumeTrue(DockerClientFactory.instance().isDockerAvailable(), "Docker not available"); + } + + public static void main(String[] args) { + new SpringApplicationBuilder(PetClinicApplication.class) // + .profiles("postgres") // + .properties( // + "spring.docker.compose.start.arguments=postgres" // + ) // + .listeners(new PropertiesLogger()) // + .run(args); + } + + @Test + void testFindAll() throws Exception { + vets.findAll(); + vets.findAll(); // served from cache + } + + @Test + void testOwnerDetails() { + RestTemplate template = builder.rootUri("http://localhost:" + port).build(); + ResponseEntity result = template.exchange(RequestEntity.get("/owners/1").build(), String.class); + assertThat(result.getStatusCode()).isEqualTo(HttpStatus.OK); + } + + static class PropertiesLogger implements ApplicationListener { + + private static final Log log = LogFactory.getLog(PropertiesLogger.class); + + private ConfigurableEnvironment environment; + + private boolean isFirstRun = true; + + @Override + public void onApplicationEvent(ApplicationPreparedEvent event) { + if (isFirstRun) { + environment = event.getApplicationContext().getEnvironment(); + printProperties(); + } + isFirstRun = false; + } + + public void printProperties() { + for (EnumerablePropertySource source : findPropertiesPropertySources()) { + log.info("PropertySource: " + source.getName()); + String[] names = source.getPropertyNames(); + Arrays.sort(names); + for (String name : names) { + String resolved = environment.getProperty(name); + + assertNotNull(resolved, "resolved environment property: " + name + " is null."); + + Object sourceProperty = source.getProperty(name); + + assertNotNull(sourceProperty, "source property was expecting an object but is null."); + + assertNotNull(sourceProperty.toString(), "source property toString() returned null."); + + String value = sourceProperty.toString(); + if (resolved.equals(value)) { + log.info(name + "=" + resolved); + } + else { + log.info(name + "=" + value + " OVERRIDDEN to " + resolved); + } + } + } + } + + private List> findPropertiesPropertySources() { + List> sources = new LinkedList<>(); + for (PropertySource source : environment.getPropertySources()) { + if (source instanceof EnumerablePropertySource enumerable) { + sources.add(enumerable); + } + } + return sources; + } + + } + +} diff --git a/src/test/java/org/springframework/samples/petclinic/model/ValidatorTests.java b/src/test/java/org/springframework/samples/petclinic/model/ValidatorTests.java index 683db21..c753285 100644 --- a/src/test/java/org/springframework/samples/petclinic/model/ValidatorTests.java +++ b/src/test/java/org/springframework/samples/petclinic/model/ValidatorTests.java @@ -53,8 +53,8 @@ class ValidatorTests { assertThat(constraintViolations).hasSize(1); ConstraintViolation violation = constraintViolations.iterator().next(); - assertThat(violation.getPropertyPath().toString()).isEqualTo("firstName"); - assertThat(violation.getMessage()).isEqualTo("must not be empty"); + assertThat(violation.getPropertyPath()).hasToString("firstName"); + assertThat(violation.getMessage()).isEqualTo("must not be blank"); } } diff --git a/src/test/java/org/springframework/samples/petclinic/owner/OwnerControllerTests.java b/src/test/java/org/springframework/samples/petclinic/owner/OwnerControllerTests.java index 778a83e..426ca5c 100644 --- a/src/test/java/org/springframework/samples/petclinic/owner/OwnerControllerTests.java +++ b/src/test/java/org/springframework/samples/petclinic/owner/OwnerControllerTests.java @@ -16,43 +16,48 @@ package org.springframework.samples.petclinic.owner; +import org.assertj.core.util.Lists; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledInNativeImage; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageImpl; +import org.springframework.data.domain.Pageable; +import org.springframework.test.context.aot.DisabledInAotMode; +import org.springframework.test.context.bean.override.mockito.MockitoBean; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; + +import java.time.LocalDate; +import java.util.Optional; + import static org.hamcrest.Matchers.empty; +import static org.hamcrest.Matchers.greaterThan; +import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.hasProperty; +import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view; - -import java.time.LocalDate; -import java.util.List; - -import org.assertj.core.util.Lists; -import org.hamcrest.BaseMatcher; -import org.hamcrest.Description; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.Mockito; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.PageImpl; -import org.springframework.data.domain.Pageable; -import org.springframework.test.web.servlet.MockMvc; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; /** * Test class for {@link OwnerController} * * @author Colin But + * @author Wick Dynex */ @WebMvcTest(OwnerController.class) +@DisabledInNativeImage +@DisabledInAotMode class OwnerControllerTests { private static final int TEST_OWNER_ID = 1; @@ -60,7 +65,7 @@ class OwnerControllerTests { @Autowired private MockMvc mockMvc; - @MockBean + @MockitoBean private OwnerRepository owners; private Owner george() { @@ -80,18 +85,18 @@ class OwnerControllerTests { george.addPet(max); max.setId(1); return george; - }; + } @BeforeEach void setup() { Owner george = george(); - given(this.owners.findByLastName(eq("Franklin"), any(Pageable.class))) - .willReturn(new PageImpl(Lists.newArrayList(george))); + given(this.owners.findByLastNameStartingWith(eq("Franklin"), any(Pageable.class))) + .willReturn(new PageImpl<>(Lists.newArrayList(george))); - given(this.owners.findAll(any(Pageable.class))).willReturn(new PageImpl(Lists.newArrayList(george))); + given(this.owners.findAll(any(Pageable.class))).willReturn(new PageImpl<>(Lists.newArrayList(george))); - given(this.owners.findById(TEST_OWNER_ID)).willReturn(george); + given(this.owners.findById(TEST_OWNER_ID)).willReturn(Optional.of(george)); Visit visit = new Visit(); visit.setDate(LocalDate.now()); george.getPet("Max").getVisits().add(visit); @@ -100,122 +105,149 @@ class OwnerControllerTests { @Test void testInitCreationForm() throws Exception { - mockMvc.perform(get("/owners/new")).andExpect(status().isOk()).andExpect(model().attributeExists("owner")) - .andExpect(view().name("owners/createOrUpdateOwnerForm")); + mockMvc.perform(get("/owners/new")) + .andExpect(status().isOk()) + .andExpect(model().attributeExists("owner")) + .andExpect(view().name("owners/createOrUpdateOwnerForm")); } @Test void testProcessCreationFormSuccess() throws Exception { - mockMvc.perform(post("/owners/new").param("firstName", "Joe").param("lastName", "Bloggs") - .param("address", "123 Caramel Street").param("city", "London").param("telephone", "01316761638")) - .andExpect(status().is3xxRedirection()); + mockMvc + .perform(post("/owners/new").param("firstName", "Joe") + .param("lastName", "Bloggs") + .param("address", "123 Caramel Street") + .param("city", "London") + .param("telephone", "1316761638")) + .andExpect(status().is3xxRedirection()); } @Test void testProcessCreationFormHasErrors() throws Exception { - mockMvc.perform( - post("/owners/new").param("firstName", "Joe").param("lastName", "Bloggs").param("city", "London")) - .andExpect(status().isOk()).andExpect(model().attributeHasErrors("owner")) - .andExpect(model().attributeHasFieldErrors("owner", "address")) - .andExpect(model().attributeHasFieldErrors("owner", "telephone")) - .andExpect(view().name("owners/createOrUpdateOwnerForm")); + mockMvc + .perform(post("/owners/new").param("firstName", "Joe").param("lastName", "Bloggs").param("city", "London")) + .andExpect(status().isOk()) + .andExpect(model().attributeHasErrors("owner")) + .andExpect(model().attributeHasFieldErrors("owner", "address")) + .andExpect(model().attributeHasFieldErrors("owner", "telephone")) + .andExpect(view().name("owners/createOrUpdateOwnerForm")); } @Test void testInitFindForm() throws Exception { - mockMvc.perform(get("/owners/find")).andExpect(status().isOk()).andExpect(model().attributeExists("owner")) - .andExpect(view().name("owners/findOwners")); + mockMvc.perform(get("/owners/find")) + .andExpect(status().isOk()) + .andExpect(model().attributeExists("owner")) + .andExpect(view().name("owners/findOwners")); } @Test void testProcessFindFormSuccess() throws Exception { - Page tasks = new PageImpl(Lists.newArrayList(george(), new Owner())); - Mockito.when(this.owners.findByLastName(anyString(), any(Pageable.class))).thenReturn(tasks); + Page tasks = new PageImpl<>(Lists.newArrayList(george(), new Owner())); + when(this.owners.findByLastNameStartingWith(anyString(), any(Pageable.class))).thenReturn(tasks); mockMvc.perform(get("/owners?page=1")).andExpect(status().isOk()).andExpect(view().name("owners/ownersList")); } @Test void testProcessFindFormByLastName() throws Exception { - Page tasks = new PageImpl(Lists.newArrayList(george())); - Mockito.when(this.owners.findByLastName(eq("Franklin"), any(Pageable.class))).thenReturn(tasks); - mockMvc.perform(get("/owners?page=1").param("lastName", "Franklin")).andExpect(status().is3xxRedirection()) - .andExpect(view().name("redirect:/owners/" + TEST_OWNER_ID)); + Page tasks = new PageImpl<>(Lists.newArrayList(george())); + when(this.owners.findByLastNameStartingWith(eq("Franklin"), any(Pageable.class))).thenReturn(tasks); + mockMvc.perform(get("/owners?page=1").param("lastName", "Franklin")) + .andExpect(status().is3xxRedirection()) + .andExpect(view().name("redirect:/owners/" + TEST_OWNER_ID)); } @Test void testProcessFindFormNoOwnersFound() throws Exception { - Page tasks = new PageImpl(Lists.newArrayList()); - Mockito.when(this.owners.findByLastName(eq("Unknown Surname"), any(Pageable.class))).thenReturn(tasks); - mockMvc.perform(get("/owners?page=1").param("lastName", "Unknown Surname")).andExpect(status().isOk()) - .andExpect(model().attributeHasFieldErrors("owner", "lastName")) - .andExpect(model().attributeHasFieldErrorCode("owner", "lastName", "notFound")) - .andExpect(view().name("owners/findOwners")); + Page tasks = new PageImpl<>(Lists.newArrayList()); + when(this.owners.findByLastNameStartingWith(eq("Unknown Surname"), any(Pageable.class))).thenReturn(tasks); + mockMvc.perform(get("/owners?page=1").param("lastName", "Unknown Surname")) + .andExpect(status().isOk()) + .andExpect(model().attributeHasFieldErrors("owner", "lastName")) + .andExpect(model().attributeHasFieldErrorCode("owner", "lastName", "notFound")) + .andExpect(view().name("owners/findOwners")); } @Test void testInitUpdateOwnerForm() throws Exception { - mockMvc.perform(get("/owners/{ownerId}/edit", TEST_OWNER_ID)).andExpect(status().isOk()) - .andExpect(model().attributeExists("owner")) - .andExpect(model().attribute("owner", hasProperty("lastName", is("Franklin")))) - .andExpect(model().attribute("owner", hasProperty("firstName", is("George")))) - .andExpect(model().attribute("owner", hasProperty("address", is("110 W. Liberty St.")))) - .andExpect(model().attribute("owner", hasProperty("city", is("Madison")))) - .andExpect(model().attribute("owner", hasProperty("telephone", is("6085551023")))) - .andExpect(view().name("owners/createOrUpdateOwnerForm")); + mockMvc.perform(get("/owners/{ownerId}/edit", TEST_OWNER_ID)) + .andExpect(status().isOk()) + .andExpect(model().attributeExists("owner")) + .andExpect(model().attribute("owner", hasProperty("lastName", is("Franklin")))) + .andExpect(model().attribute("owner", hasProperty("firstName", is("George")))) + .andExpect(model().attribute("owner", hasProperty("address", is("110 W. Liberty St.")))) + .andExpect(model().attribute("owner", hasProperty("city", is("Madison")))) + .andExpect(model().attribute("owner", hasProperty("telephone", is("6085551023")))) + .andExpect(view().name("owners/createOrUpdateOwnerForm")); } @Test void testProcessUpdateOwnerFormSuccess() throws Exception { - mockMvc.perform(post("/owners/{ownerId}/edit", TEST_OWNER_ID).param("firstName", "Joe") - .param("lastName", "Bloggs").param("address", "123 Caramel Street").param("city", "London") - .param("telephone", "01616291589")).andExpect(status().is3xxRedirection()) - .andExpect(view().name("redirect:/owners/{ownerId}")); + mockMvc + .perform(post("/owners/{ownerId}/edit", TEST_OWNER_ID).param("firstName", "Joe") + .param("lastName", "Bloggs") + .param("address", "123 Caramel Street") + .param("city", "London") + .param("telephone", "1616291589")) + .andExpect(status().is3xxRedirection()) + .andExpect(view().name("redirect:/owners/{ownerId}")); } @Test void testProcessUpdateOwnerFormUnchangedSuccess() throws Exception { - mockMvc.perform(post("/owners/{ownerId}/edit", TEST_OWNER_ID)).andExpect(status().is3xxRedirection()) - .andExpect(view().name("redirect:/owners/{ownerId}")); + mockMvc.perform(post("/owners/{ownerId}/edit", TEST_OWNER_ID)) + .andExpect(status().is3xxRedirection()) + .andExpect(view().name("redirect:/owners/{ownerId}")); } @Test void testProcessUpdateOwnerFormHasErrors() throws Exception { - mockMvc.perform(post("/owners/{ownerId}/edit", TEST_OWNER_ID).param("firstName", "Joe") - .param("lastName", "Bloggs").param("address", "").param("telephone", "")).andExpect(status().isOk()) - .andExpect(model().attributeHasErrors("owner")) - .andExpect(model().attributeHasFieldErrors("owner", "address")) - .andExpect(model().attributeHasFieldErrors("owner", "telephone")) - .andExpect(view().name("owners/createOrUpdateOwnerForm")); + mockMvc + .perform(post("/owners/{ownerId}/edit", TEST_OWNER_ID).param("firstName", "Joe") + .param("lastName", "Bloggs") + .param("address", "") + .param("telephone", "")) + .andExpect(status().isOk()) + .andExpect(model().attributeHasErrors("owner")) + .andExpect(model().attributeHasFieldErrors("owner", "address")) + .andExpect(model().attributeHasFieldErrors("owner", "telephone")) + .andExpect(view().name("owners/createOrUpdateOwnerForm")); } @Test void testShowOwner() throws Exception { - mockMvc.perform(get("/owners/{ownerId}", TEST_OWNER_ID)).andExpect(status().isOk()) - .andExpect(model().attribute("owner", hasProperty("lastName", is("Franklin")))) - .andExpect(model().attribute("owner", hasProperty("firstName", is("George")))) - .andExpect(model().attribute("owner", hasProperty("address", is("110 W. Liberty St.")))) - .andExpect(model().attribute("owner", hasProperty("city", is("Madison")))) - .andExpect(model().attribute("owner", hasProperty("telephone", is("6085551023")))) - .andExpect(model().attribute("owner", hasProperty("pets", not(empty())))) - .andExpect(model().attribute("owner", hasProperty("pets", new BaseMatcher>() { + mockMvc.perform(get("/owners/{ownerId}", TEST_OWNER_ID)) + .andExpect(status().isOk()) + .andExpect(model().attribute("owner", hasProperty("lastName", is("Franklin")))) + .andExpect(model().attribute("owner", hasProperty("firstName", is("George")))) + .andExpect(model().attribute("owner", hasProperty("address", is("110 W. Liberty St.")))) + .andExpect(model().attribute("owner", hasProperty("city", is("Madison")))) + .andExpect(model().attribute("owner", hasProperty("telephone", is("6085551023")))) + .andExpect(model().attribute("owner", hasProperty("pets", not(empty())))) + .andExpect(model().attribute("owner", + hasProperty("pets", hasItem(hasProperty("visits", hasSize(greaterThan(0))))))) + .andExpect(view().name("owners/ownerDetails")); + } - @Override - public boolean matches(Object item) { - @SuppressWarnings("unchecked") - List pets = (List) item; - Pet pet = pets.get(0); - if (pet.getVisits().isEmpty()) { - return false; - } - return true; - } + @Test + public void testProcessUpdateOwnerFormWithIdMismatch() throws Exception { + int pathOwnerId = 1; - @Override - public void describeTo(Description description) { - description.appendText("Max did not have any visits"); - } - }))).andExpect(view().name("owners/ownerDetails")); + Owner owner = new Owner(); + owner.setId(2); + owner.setFirstName("John"); + owner.setLastName("Doe"); + owner.setAddress("Center Street"); + owner.setCity("New York"); + owner.setTelephone("0123456789"); + + when(owners.findById(pathOwnerId)).thenReturn(Optional.of(owner)); + + mockMvc.perform(MockMvcRequestBuilders.post("/owners/{ownerId}/edit", pathOwnerId).flashAttr("owner", owner)) + .andExpect(status().is3xxRedirection()) + .andExpect(redirectedUrl("/owners/" + pathOwnerId + "/edit")) + .andExpect(flash().attributeExists("error")); } } diff --git a/src/test/java/org/springframework/samples/petclinic/owner/PetControllerTests.java b/src/test/java/org/springframework/samples/petclinic/owner/PetControllerTests.java old mode 100755 new mode 100644 index cefdc28..9a6134c --- a/src/test/java/org/springframework/samples/petclinic/owner/PetControllerTests.java +++ b/src/test/java/org/springframework/samples/petclinic/owner/PetControllerTests.java @@ -18,26 +18,37 @@ package org.springframework.samples.petclinic.owner; import org.assertj.core.util.Lists; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledInNativeImage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.FilterType; +import org.springframework.test.context.aot.DisabledInAotMode; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.web.servlet.MockMvc; +import java.time.LocalDate; +import java.util.Optional; + import static org.mockito.BDDMockito.given; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view; /** * Test class for the {@link PetController} * * @author Colin But + * @author Wick Dynex */ @WebMvcTest(value = PetController.class, includeFilters = @ComponentScan.Filter(value = PetTypeFormatter.class, type = FilterType.ASSIGNABLE_TYPE)) +@DisabledInNativeImage +@DisabledInAotMode class PetControllerTests { private static final int TEST_OWNER_ID = 1; @@ -47,7 +58,7 @@ class PetControllerTests { @Autowired private MockMvc mockMvc; - @MockBean + @MockitoBean private OwnerRepository owners; @BeforeEach @@ -56,55 +67,142 @@ class PetControllerTests { cat.setId(3); cat.setName("hamster"); given(this.owners.findPetTypes()).willReturn(Lists.newArrayList(cat)); + Owner owner = new Owner(); Pet pet = new Pet(); + Pet dog = new Pet(); owner.addPet(pet); + owner.addPet(dog); pet.setId(TEST_PET_ID); - given(this.owners.findById(TEST_OWNER_ID)).willReturn(owner); + dog.setId(TEST_PET_ID + 1); + pet.setName("petty"); + dog.setName("doggy"); + given(this.owners.findById(TEST_OWNER_ID)).willReturn(Optional.of(owner)); } @Test void testInitCreationForm() throws Exception { - mockMvc.perform(get("/owners/{ownerId}/pets/new", TEST_OWNER_ID)).andExpect(status().isOk()) - .andExpect(view().name("pets/createOrUpdatePetForm")).andExpect(model().attributeExists("pet")); + mockMvc.perform(get("/owners/{ownerId}/pets/new", TEST_OWNER_ID)) + .andExpect(status().isOk()) + .andExpect(view().name("pets/createOrUpdatePetForm")) + .andExpect(model().attributeExists("pet")); } @Test void testProcessCreationFormSuccess() throws Exception { - mockMvc.perform(post("/owners/{ownerId}/pets/new", TEST_OWNER_ID).param("name", "Betty") - .param("type", "hamster").param("birthDate", "2015-02-12")).andExpect(status().is3xxRedirection()) - .andExpect(view().name("redirect:/owners/{ownerId}")); + mockMvc + .perform(post("/owners/{ownerId}/pets/new", TEST_OWNER_ID).param("name", "Betty") + .param("type", "hamster") + .param("birthDate", "2015-02-12")) + .andExpect(status().is3xxRedirection()) + .andExpect(view().name("redirect:/owners/{ownerId}")); } - @Test - void testProcessCreationFormHasErrors() throws Exception { - mockMvc.perform(post("/owners/{ownerId}/pets/new", TEST_OWNER_ID).param("name", "Betty").param("birthDate", - "2015-02-12")).andExpect(model().attributeHasNoErrors("owner")) - .andExpect(model().attributeHasErrors("pet")).andExpect(model().attributeHasFieldErrors("pet", "type")) - .andExpect(model().attributeHasFieldErrorCode("pet", "type", "required")).andExpect(status().isOk()) - .andExpect(view().name("pets/createOrUpdatePetForm")); - } + @Nested + class ProcessCreationFormHasErrors { - @Test - void testInitUpdateForm() throws Exception { - mockMvc.perform(get("/owners/{ownerId}/pets/{petId}/edit", TEST_OWNER_ID, TEST_PET_ID)) - .andExpect(status().isOk()).andExpect(model().attributeExists("pet")) + @Test + void testProcessCreationFormWithBlankName() throws Exception { + mockMvc + .perform(post("/owners/{ownerId}/pets/new", TEST_OWNER_ID).param("name", "\t \n") + .param("birthDate", "2015-02-12")) + .andExpect(model().attributeHasNoErrors("owner")) + .andExpect(model().attributeHasErrors("pet")) + .andExpect(model().attributeHasFieldErrors("pet", "name")) + .andExpect(model().attributeHasFieldErrorCode("pet", "name", "required")) + .andExpect(status().isOk()) .andExpect(view().name("pets/createOrUpdatePetForm")); + } + + @Test + void testProcessCreationFormWithDuplicateName() throws Exception { + mockMvc + .perform(post("/owners/{ownerId}/pets/new", TEST_OWNER_ID).param("name", "petty") + .param("birthDate", "2015-02-12")) + .andExpect(model().attributeHasNoErrors("owner")) + .andExpect(model().attributeHasErrors("pet")) + .andExpect(model().attributeHasFieldErrors("pet", "name")) + .andExpect(model().attributeHasFieldErrorCode("pet", "name", "duplicate")) + .andExpect(status().isOk()) + .andExpect(view().name("pets/createOrUpdatePetForm")); + } + + @Test + void testProcessCreationFormWithMissingPetType() throws Exception { + mockMvc + .perform(post("/owners/{ownerId}/pets/new", TEST_OWNER_ID).param("name", "Betty") + .param("birthDate", "2015-02-12")) + .andExpect(model().attributeHasNoErrors("owner")) + .andExpect(model().attributeHasErrors("pet")) + .andExpect(model().attributeHasFieldErrors("pet", "type")) + .andExpect(model().attributeHasFieldErrorCode("pet", "type", "required")) + .andExpect(status().isOk()) + .andExpect(view().name("pets/createOrUpdatePetForm")); + } + + @Test + void testProcessCreationFormWithInvalidBirthDate() throws Exception { + LocalDate currentDate = LocalDate.now(); + String futureBirthDate = currentDate.plusMonths(1).toString(); + + mockMvc + .perform(post("/owners/{ownerId}/pets/new", TEST_OWNER_ID).param("name", "Betty") + .param("birthDate", futureBirthDate)) + .andExpect(model().attributeHasNoErrors("owner")) + .andExpect(model().attributeHasErrors("pet")) + .andExpect(model().attributeHasFieldErrors("pet", "birthDate")) + .andExpect(model().attributeHasFieldErrorCode("pet", "birthDate", "typeMismatch.birthDate")) + .andExpect(status().isOk()) + .andExpect(view().name("pets/createOrUpdatePetForm")); + } + + @Test + void testInitUpdateForm() throws Exception { + mockMvc.perform(get("/owners/{ownerId}/pets/{petId}/edit", TEST_OWNER_ID, TEST_PET_ID)) + .andExpect(status().isOk()) + .andExpect(model().attributeExists("pet")) + .andExpect(view().name("pets/createOrUpdatePetForm")); + } + } @Test void testProcessUpdateFormSuccess() throws Exception { - mockMvc.perform(post("/owners/{ownerId}/pets/{petId}/edit", TEST_OWNER_ID, TEST_PET_ID).param("name", "Betty") - .param("type", "hamster").param("birthDate", "2015-02-12")).andExpect(status().is3xxRedirection()) - .andExpect(view().name("redirect:/owners/{ownerId}")); + mockMvc + .perform(post("/owners/{ownerId}/pets/{petId}/edit", TEST_OWNER_ID, TEST_PET_ID).param("name", "Betty") + .param("type", "hamster") + .param("birthDate", "2015-02-12")) + .andExpect(status().is3xxRedirection()) + .andExpect(view().name("redirect:/owners/{ownerId}")); } - @Test - void testProcessUpdateFormHasErrors() throws Exception { - mockMvc.perform(post("/owners/{ownerId}/pets/{petId}/edit", TEST_OWNER_ID, TEST_PET_ID).param("name", "Betty") - .param("birthDate", "2015/02/12")).andExpect(model().attributeHasNoErrors("owner")) - .andExpect(model().attributeHasErrors("pet")).andExpect(status().isOk()) + @Nested + class ProcessUpdateFormHasErrors { + + @Test + void testProcessUpdateFormWithInvalidBirthDate() throws Exception { + mockMvc + .perform(post("/owners/{ownerId}/pets/{petId}/edit", TEST_OWNER_ID, TEST_PET_ID).param("name", " ") + .param("birthDate", "2015/02/12")) + .andExpect(model().attributeHasNoErrors("owner")) + .andExpect(model().attributeHasErrors("pet")) + .andExpect(model().attributeHasFieldErrors("pet", "birthDate")) + .andExpect(model().attributeHasFieldErrorCode("pet", "birthDate", "typeMismatch")) .andExpect(view().name("pets/createOrUpdatePetForm")); + } + + @Test + void testProcessUpdateFormWithBlankName() throws Exception { + mockMvc + .perform(post("/owners/{ownerId}/pets/{petId}/edit", TEST_OWNER_ID, TEST_PET_ID).param("name", " ") + .param("birthDate", "2015-02-12")) + .andExpect(model().attributeHasNoErrors("owner")) + .andExpect(model().attributeHasErrors("pet")) + .andExpect(model().attributeHasFieldErrors("pet", "name")) + .andExpect(model().attributeHasFieldErrorCode("pet", "name", "required")) + .andExpect(view().name("pets/createOrUpdatePetForm")); + } + } } diff --git a/src/test/java/org/springframework/samples/petclinic/owner/PetTypeFormatterTests.java b/src/test/java/org/springframework/samples/petclinic/owner/PetTypeFormatterTests.java index 0d50b44..0295b47 100644 --- a/src/test/java/org/springframework/samples/petclinic/owner/PetTypeFormatterTests.java +++ b/src/test/java/org/springframework/samples/petclinic/owner/PetTypeFormatterTests.java @@ -28,6 +28,7 @@ import java.util.Locale; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledInNativeImage; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; @@ -38,6 +39,7 @@ import org.mockito.junit.jupiter.MockitoExtension; * @author Colin But */ @ExtendWith(MockitoExtension.class) +@DisabledInNativeImage class PetTypeFormatterTests { @Mock @@ -66,7 +68,7 @@ class PetTypeFormatterTests { } @Test - void shouldThrowParseException() throws ParseException { + void shouldThrowParseException() { given(this.pets.findPetTypes()).willReturn(makePetTypes()); Assertions.assertThrows(ParseException.class, () -> { petTypeFormatter.parse("Fish", Locale.ENGLISH); diff --git a/src/test/java/org/springframework/samples/petclinic/owner/PetValidatorTests.java b/src/test/java/org/springframework/samples/petclinic/owner/PetValidatorTests.java new file mode 100644 index 0000000..1a153bc --- /dev/null +++ b/src/test/java/org/springframework/samples/petclinic/owner/PetValidatorTests.java @@ -0,0 +1,117 @@ +/* + * Copyright 2012-2024 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.samples.petclinic.owner; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledInNativeImage; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; +import org.springframework.validation.Errors; +import org.springframework.validation.MapBindingResult; + +import java.time.LocalDate; +import java.util.HashMap; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * Test class for {@link PetValidator} + * + * @author Wick Dynex + */ +@ExtendWith(MockitoExtension.class) +@DisabledInNativeImage +public class PetValidatorTests { + + private PetValidator petValidator; + + private Pet pet; + + private PetType petType; + + private Errors errors; + + private static final String petName = "Buddy"; + + private static final String petTypeName = "Dog"; + + private static final LocalDate petBirthDate = LocalDate.of(1990, 1, 1); + + @BeforeEach + void setUp() { + petValidator = new PetValidator(); + pet = new Pet(); + petType = new PetType(); + errors = new MapBindingResult(new HashMap<>(), "pet"); + } + + @Test + void testValidate() { + petType.setName(petTypeName); + pet.setName(petName); + pet.setType(petType); + pet.setBirthDate(petBirthDate); + + petValidator.validate(pet, errors); + + assertFalse(errors.hasErrors()); + } + + @Nested + class ValidateHasErrors { + + @Test + void testValidateWithInvalidPetName() { + petType.setName(petTypeName); + pet.setName(""); + pet.setType(petType); + pet.setBirthDate(petBirthDate); + + petValidator.validate(pet, errors); + + assertTrue(errors.hasFieldErrors("name")); + } + + @Test + void testValidateWithInvalidPetType() { + pet.setName(petName); + pet.setType(null); + pet.setBirthDate(petBirthDate); + + petValidator.validate(pet, errors); + + assertTrue(errors.hasFieldErrors("type")); + } + + @Test + void testValidateWithInvalidBirthDate() { + petType.setName(petTypeName); + pet.setName(petName); + pet.setType(petType); + pet.setBirthDate(null); + + petValidator.validate(pet, errors); + + assertTrue(errors.hasFieldErrors("birthDate")); + } + + } + +} diff --git a/src/test/java/org/springframework/samples/petclinic/owner/VisitControllerTests.java b/src/test/java/org/springframework/samples/petclinic/owner/VisitControllerTests.java index 1ecf045..e42e750 100644 --- a/src/test/java/org/springframework/samples/petclinic/owner/VisitControllerTests.java +++ b/src/test/java/org/springframework/samples/petclinic/owner/VisitControllerTests.java @@ -25,17 +25,24 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledInNativeImage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.test.context.aot.DisabledInAotMode; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.web.servlet.MockMvc; +import java.util.Optional; + /** * Test class for {@link VisitController} * * @author Colin But + * @author Wick Dynex */ @WebMvcTest(VisitController.class) +@DisabledInNativeImage +@DisabledInAotMode class VisitControllerTests { private static final int TEST_OWNER_ID = 1; @@ -45,7 +52,7 @@ class VisitControllerTests { @Autowired private MockMvc mockMvc; - @MockBean + @MockitoBean private OwnerRepository owners; @BeforeEach @@ -54,28 +61,34 @@ class VisitControllerTests { Pet pet = new Pet(); owner.addPet(pet); pet.setId(TEST_PET_ID); - given(this.owners.findById(TEST_OWNER_ID)).willReturn(owner); + given(this.owners.findById(TEST_OWNER_ID)).willReturn(Optional.of(owner)); } @Test void testInitNewVisitForm() throws Exception { mockMvc.perform(get("/owners/{ownerId}/pets/{petId}/visits/new", TEST_OWNER_ID, TEST_PET_ID)) - .andExpect(status().isOk()).andExpect(view().name("pets/createOrUpdateVisitForm")); + .andExpect(status().isOk()) + .andExpect(view().name("pets/createOrUpdateVisitForm")); } @Test void testProcessNewVisitFormSuccess() throws Exception { - mockMvc.perform(post("/owners/{ownerId}/pets/{petId}/visits/new", TEST_OWNER_ID, TEST_PET_ID) - .param("name", "George").param("description", "Visit Description")) - .andExpect(status().is3xxRedirection()).andExpect(view().name("redirect:/owners/{ownerId}")); + mockMvc + .perform(post("/owners/{ownerId}/pets/{petId}/visits/new", TEST_OWNER_ID, TEST_PET_ID) + .param("name", "George") + .param("description", "Visit Description")) + .andExpect(status().is3xxRedirection()) + .andExpect(view().name("redirect:/owners/{ownerId}")); } @Test void testProcessNewVisitFormHasErrors() throws Exception { - mockMvc.perform( - post("/owners/{ownerId}/pets/{petId}/visits/new", TEST_OWNER_ID, TEST_PET_ID).param("name", "George")) - .andExpect(model().attributeHasErrors("visit")).andExpect(status().isOk()) - .andExpect(view().name("pets/createOrUpdateVisitForm")); + mockMvc + .perform(post("/owners/{ownerId}/pets/{petId}/visits/new", TEST_OWNER_ID, TEST_PET_ID).param("name", + "George")) + .andExpect(model().attributeHasErrors("visit")) + .andExpect(status().isOk()) + .andExpect(view().name("pets/createOrUpdateVisitForm")); } } diff --git a/src/test/java/org/springframework/samples/petclinic/service/ClinicServiceTests.java b/src/test/java/org/springframework/samples/petclinic/service/ClinicServiceTests.java index 9115e03..1736027 100644 --- a/src/test/java/org/springframework/samples/petclinic/service/ClinicServiceTests.java +++ b/src/test/java/org/springframework/samples/petclinic/service/ClinicServiceTests.java @@ -20,13 +20,13 @@ import static org.assertj.core.api.Assertions.assertThat; import java.time.LocalDate; import java.util.Collection; +import java.util.Optional; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase.Replace; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; -import org.springframework.context.annotation.ComponentScan; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.samples.petclinic.owner.Owner; @@ -36,7 +36,6 @@ import org.springframework.samples.petclinic.owner.PetType; import org.springframework.samples.petclinic.owner.Visit; import org.springframework.samples.petclinic.vet.Vet; import org.springframework.samples.petclinic.vet.VetRepository; -import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; /** @@ -67,7 +66,7 @@ import org.springframework.transaction.annotation.Transactional; * @author Michael Isvy * @author Dave Syer */ -@DataJpaTest(includeFilters = @ComponentScan.Filter(Service.class)) +@DataJpaTest // Ensure that if the mysql profile is active we connect to the real database: @AutoConfigureTestDatabase(replace = Replace.NONE) // @TestPropertySource("/application-postgres.properties") @@ -83,16 +82,18 @@ class ClinicServiceTests { @Test void shouldFindOwnersByLastName() { - Page owners = this.owners.findByLastName("Davis", pageable); + Page owners = this.owners.findByLastNameStartingWith("Davis", pageable); assertThat(owners).hasSize(2); - owners = this.owners.findByLastName("Daviss", pageable); + owners = this.owners.findByLastNameStartingWith("Daviss", pageable); assertThat(owners).isEmpty(); } @Test void shouldFindSingleOwnerWithPet() { - Owner owner = this.owners.findById(1); + Optional optionalOwner = this.owners.findById(1); + assertThat(optionalOwner).isPresent(); + Owner owner = optionalOwner.get(); assertThat(owner.getLastName()).startsWith("Franklin"); assertThat(owner.getPets()).hasSize(1); assertThat(owner.getPets().get(0).getType()).isNotNull(); @@ -102,7 +103,7 @@ class ClinicServiceTests { @Test @Transactional void shouldInsertOwner() { - Page owners = this.owners.findByLastName("Schultz", pageable); + Page owners = this.owners.findByLastNameStartingWith("Schultz", pageable); int found = (int) owners.getTotalElements(); Owner owner = new Owner(); @@ -112,16 +113,18 @@ class ClinicServiceTests { owner.setCity("Wollongong"); owner.setTelephone("4444444444"); this.owners.save(owner); - assertThat(owner.getId().longValue()).isNotEqualTo(0); + assertThat(owner.getId()).isNotZero(); - owners = this.owners.findByLastName("Schultz", pageable); + owners = this.owners.findByLastNameStartingWith("Schultz", pageable); assertThat(owners.getTotalElements()).isEqualTo(found + 1); } @Test @Transactional void shouldUpdateOwner() { - Owner owner = this.owners.findById(1); + Optional optionalOwner = this.owners.findById(1); + assertThat(optionalOwner).isPresent(); + Owner owner = optionalOwner.get(); String oldLastName = owner.getLastName(); String newLastName = oldLastName + "X"; @@ -129,7 +132,9 @@ class ClinicServiceTests { this.owners.save(owner); // retrieving new name from database - owner = this.owners.findById(1); + optionalOwner = this.owners.findById(1); + assertThat(optionalOwner).isPresent(); + owner = optionalOwner.get(); assertThat(owner.getLastName()).isEqualTo(newLastName); } @@ -146,7 +151,10 @@ class ClinicServiceTests { @Test @Transactional void shouldInsertPetIntoDatabaseAndGenerateId() { - Owner owner6 = this.owners.findById(6); + Optional optionalOwner = this.owners.findById(6); + assertThat(optionalOwner).isPresent(); + Owner owner6 = optionalOwner.get(); + int found = owner6.getPets().size(); Pet pet = new Pet(); @@ -155,12 +163,14 @@ class ClinicServiceTests { pet.setType(EntityUtils.getById(types, PetType.class, 2)); pet.setBirthDate(LocalDate.now()); owner6.addPet(pet); - assertThat(owner6.getPets().size()).isEqualTo(found + 1); + assertThat(owner6.getPets()).hasSize(found + 1); this.owners.save(owner6); - owner6 = this.owners.findById(6); - assertThat(owner6.getPets().size()).isEqualTo(found + 1); + optionalOwner = this.owners.findById(6); + assertThat(optionalOwner).isPresent(); + owner6 = optionalOwner.get(); + assertThat(owner6.getPets()).hasSize(found + 1); // checks that id has been generated pet = owner6.getPet("bowser"); assertThat(pet.getId()).isNotNull(); @@ -168,8 +178,11 @@ class ClinicServiceTests { @Test @Transactional - void shouldUpdatePetName() throws Exception { - Owner owner6 = this.owners.findById(6); + void shouldUpdatePetName() { + Optional optionalOwner = this.owners.findById(6); + assertThat(optionalOwner).isPresent(); + Owner owner6 = optionalOwner.get(); + Pet pet7 = owner6.getPet(7); String oldName = pet7.getName(); @@ -177,7 +190,9 @@ class ClinicServiceTests { pet7.setName(newName); this.owners.save(owner6); - owner6 = this.owners.findById(6); + optionalOwner = this.owners.findById(6); + assertThat(optionalOwner).isPresent(); + owner6 = optionalOwner.get(); pet7 = owner6.getPet(7); assertThat(pet7.getName()).isEqualTo(newName); } @@ -196,7 +211,10 @@ class ClinicServiceTests { @Test @Transactional void shouldAddNewVisitForPet() { - Owner owner6 = this.owners.findById(6); + Optional optionalOwner = this.owners.findById(6); + assertThat(optionalOwner).isPresent(); + Owner owner6 = optionalOwner.get(); + Pet pet7 = owner6.getPet(7); int found = pet7.getVisits().size(); Visit visit = new Visit(); @@ -205,22 +223,25 @@ class ClinicServiceTests { owner6.addVisit(pet7.getId(), visit); this.owners.save(owner6); - owner6 = this.owners.findById(6); - assertThat(pet7.getVisits()) // - .hasSize(found + 1) // - .allMatch(value -> value.getId() != null); + .hasSize(found + 1) // + .allMatch(value -> value.getId() != null); } @Test - void shouldFindVisitsByPetId() throws Exception { - Owner owner6 = this.owners.findById(6); + void shouldFindVisitsByPetId() { + Optional optionalOwner = this.owners.findById(6); + assertThat(optionalOwner).isPresent(); + Owner owner6 = optionalOwner.get(); + Pet pet7 = owner6.getPet(7); Collection visits = pet7.getVisits(); assertThat(visits) // - .hasSize(2) // - .element(0).extracting(Visit::getDate).isNotNull(); + .hasSize(2) // + .element(0) + .extracting(Visit::getDate) + .isNotNull(); } } diff --git a/src/test/java/org/springframework/samples/petclinic/system/CrashControllerIntegrationTests.java b/src/test/java/org/springframework/samples/petclinic/system/CrashControllerIntegrationTests.java new file mode 100644 index 0000000..3cdca47 --- /dev/null +++ b/src/test/java/org/springframework/samples/petclinic/system/CrashControllerIntegrationTests.java @@ -0,0 +1,99 @@ +/* + * Copyright 2012-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.samples.petclinic.system; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT; + +import java.util.List; +import java.util.Map; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; +import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.core.ParameterizedTypeReference; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.RequestEntity; +import org.springframework.http.ResponseEntity; + +/** + * Integration Test for {@link CrashController}. + * + * @author Alex Lutz + */ +// NOT Waiting https://github.com/spring-projects/spring-boot/issues/5574 +@SpringBootTest(webEnvironment = RANDOM_PORT, + properties = { "server.error.include-message=ALWAYS", "management.endpoints.enabled-by-default=false" }) +class CrashControllerIntegrationTests { + + @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, + DataSourceTransactionManagerAutoConfiguration.class, HibernateJpaAutoConfiguration.class }) + static class TestConfiguration { + + } + + @Value(value = "${local.server.port}") + private int port; + + @Autowired + private TestRestTemplate rest; + + @Test + void testTriggerExceptionJson() { + ResponseEntity> resp = rest.exchange( + RequestEntity.get("http://localhost:" + port + "/oups").build(), + new ParameterizedTypeReference>() { + }); + assertThat(resp).isNotNull(); + assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR); + assertThat(resp.getBody()).containsKey("timestamp"); + assertThat(resp.getBody()).containsKey("status"); + assertThat(resp.getBody()).containsKey("error"); + assertThat(resp.getBody()).containsEntry("message", + "Expected: controller used to showcase what happens when an exception is thrown"); + assertThat(resp.getBody()).containsEntry("path", "/oups"); + } + + @Test + void testTriggerExceptionHtml() { + HttpHeaders headers = new HttpHeaders(); + headers.setAccept(List.of(MediaType.TEXT_HTML)); + ResponseEntity resp = rest.exchange("http://localhost:" + port + "/oups", HttpMethod.GET, + new HttpEntity<>(headers), String.class); + assertThat(resp).isNotNull(); + assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR); + assertThat(resp.getBody()).isNotNull(); + // html: + assertThat(resp.getBody()).containsSubsequence("", "

", "Something happened...", "

", "

", + "Expected:", "controller", "used", "to", "showcase", "what", "happens", "when", "an", "exception", "is", + "thrown", "

", ""); + // Not the whitelabel error page: + assertThat(resp.getBody()).doesNotContain("Whitelabel Error Page", + "This application has no explicit mapping for"); + } + +} diff --git a/src/test/java/org/springframework/samples/petclinic/system/CrashControllerTests.java b/src/test/java/org/springframework/samples/petclinic/system/CrashControllerTests.java index 06e7140..cc2ad67 100644 --- a/src/test/java/org/springframework/samples/petclinic/system/CrashControllerTests.java +++ b/src/test/java/org/springframework/samples/petclinic/system/CrashControllerTests.java @@ -16,33 +16,26 @@ package org.springframework.samples.petclinic.system; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.test.web.servlet.MockMvc; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import static org.assertj.core.api.Assertions.assertThatExceptionOfType; /** * Test class for {@link CrashController} * * @author Colin But + * @author Alex Lutz */ -// Waiting https://github.com/spring-projects/spring-boot/issues/5574 -@Disabled -@WebMvcTest(controllers = CrashController.class) +// Waiting https://github.com/spring-projects/spring-boot/issues/5574 ..good +// luck ((plain(st) UNIT test)! :) class CrashControllerTests { - @Autowired - private MockMvc mockMvc; + final CrashController testee = new CrashController(); @Test - void testTriggerException() throws Exception { - mockMvc.perform(get("/oups")).andExpect(view().name("exception")) - .andExpect(model().attributeExists("exception")).andExpect(forwardedUrl("exception")) - .andExpect(status().isOk()); + void testTriggerException() { + assertThatExceptionOfType(RuntimeException.class).isThrownBy(() -> testee.triggerException()) + .withMessageContaining("Expected: controller used to showcase what happens when an exception is thrown"); } } diff --git a/src/test/java/org/springframework/samples/petclinic/vet/VetControllerTests.java b/src/test/java/org/springframework/samples/petclinic/vet/VetControllerTests.java index 4679bd6..5fffeea 100644 --- a/src/test/java/org/springframework/samples/petclinic/vet/VetControllerTests.java +++ b/src/test/java/org/springframework/samples/petclinic/vet/VetControllerTests.java @@ -19,12 +19,14 @@ package org.springframework.samples.petclinic.vet; import org.assertj.core.util.Lists; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.DisabledInNativeImage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.Pageable; import org.springframework.http.MediaType; +import org.springframework.test.context.aot.DisabledInAotMode; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.ResultActions; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; @@ -39,12 +41,14 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. */ @WebMvcTest(VetController.class) +@DisabledInNativeImage +@DisabledInAotMode class VetControllerTests { @Autowired private MockMvc mockMvc; - @MockBean + @MockitoBean private VetRepository vets; private Vet james() { @@ -71,24 +75,26 @@ class VetControllerTests { void setup() { given(this.vets.findAll()).willReturn(Lists.newArrayList(james(), helen())); given(this.vets.findAll(any(Pageable.class))) - .willReturn(new PageImpl(Lists.newArrayList(james(), helen()))); + .willReturn(new PageImpl(Lists.newArrayList(james(), helen()))); } @Test void testShowVetListHtml() throws Exception { - mockMvc.perform(MockMvcRequestBuilders.get("/vets.html?page=1")).andExpect(status().isOk()) - .andExpect(model().attributeExists("listVets")).andExpect(view().name("vets/vetList")); + mockMvc.perform(MockMvcRequestBuilders.get("/vets.html?page=1")) + .andExpect(status().isOk()) + .andExpect(model().attributeExists("listVets")) + .andExpect(view().name("vets/vetList")); } @Test void testShowResourcesVetList() throws Exception { ResultActions actions = mockMvc.perform(get("/vets").accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()); + .andExpect(status().isOk()); actions.andExpect(content().contentType(MediaType.APPLICATION_JSON)) - .andExpect(jsonPath("$.vetList[0].id").value(1)); + .andExpect(jsonPath("$.vetList[0].id").value(1)); } } diff --git a/src/test/java/org/springframework/samples/petclinic/vet/VetTests.java b/src/test/java/org/springframework/samples/petclinic/vet/VetTests.java index d8df78b..b29c6d1 100644 --- a/src/test/java/org/springframework/samples/petclinic/vet/VetTests.java +++ b/src/test/java/org/springframework/samples/petclinic/vet/VetTests.java @@ -31,6 +31,7 @@ class VetTests { vet.setFirstName("Zaphod"); vet.setLastName("Beeblebrox"); vet.setId(123); + @SuppressWarnings("deprecation") Vet other = (Vet) SerializationUtils.deserialize(SerializationUtils.serialize(vet)); assertThat(other.getFirstName()).isEqualTo(vet.getFirstName()); assertThat(other.getLastName()).isEqualTo(vet.getLastName()); diff --git a/src/test/jmeter/petclinic_test_plan.jmx b/src/test/jmeter/petclinic_test_plan.jmx index 0a9a3a5..89c7bf2 100644 --- a/src/test/jmeter/petclinic_test_plan.jmx +++ b/src/test/jmeter/petclinic_test_plan.jmx @@ -1,11 +1,13 @@ - + false false - + PETCLINIC_HOST @@ -27,9 +29,12 @@ - + continue - + false 10 @@ -44,13 +49,17 @@ Original : 500 - 10 - 10 - + 300 - - - - + + + + ${PETCLINIC_HOST} ${PETCLINIC_PORT} @@ -61,33 +70,39 @@ 4 - - - + + + true - - + + 1 - 10 + 3 1 count false - - + + 1 - 13 + 3 1 petCount false - - - - + + + + @@ -104,10 +119,13 @@ false - - - - + + + + @@ -124,10 +142,13 @@ false - - - - + + + + @@ -135,7 +156,7 @@ - ${CONTEXT_WEB}/webjars/jquery/jquery.min.js + ${CONTEXT_WEB}/webjars/bootstrap/dist/js/bootstrap.bundle.min.js GET true false @@ -144,10 +165,13 @@ false - - - - + + + + @@ -164,10 +188,13 @@ false - - - - + + + + @@ -184,10 +211,13 @@ false - - - - + + + + @@ -204,10 +234,13 @@ false - - - - + + + + @@ -224,10 +257,13 @@ false - - - - + + + + @@ -244,15 +280,47 @@ false - - - true - + + + - + false - firstName=Test&lastName=${count}&address=1234+Test+St.&city=TestCity&telephone=612345678 + Test = + true + firstName + + + false + ${count} + = + true + lastName + + + false + 1234+Test+St. + = + true + address + + + false + TestCity + = + true + city + + + false + 612345678 + = + true + telephone @@ -271,10 +339,13 @@ false - - - - + + + + @@ -282,7 +353,7 @@ - ${CONTEXT_WEB}/owners/${count}/pets/${petCount}/visits/new + ${CONTEXT_WEB}/owners/${count}/pets/new GET true false @@ -291,15 +362,33 @@ false - - - true - + + + - + false - date=2013%2F02%2F22&description=visit + Test+Fluffy+${petCount} = + true + name + + + false + 2020-12-20 + = + true + birthDate + + + false + cat + = + true + type @@ -309,6 +398,64 @@ + ${CONTEXT_WEB}/owners/${count}/pets/new + POST + true + false + true + false + false + + + + + + + + + + + + ${CONTEXT_WEB}/owners/${count}/pets/${petCount}/visits/new + GET + true + false + true + false + + + + + + + + + + false + 2013-02-22 + = + true + date + + + false + visit + = + true + description + + + + + + + ${CONTEXT_WEB}/owners/${count}/pets/${petCount}/visits/new POST true @@ -318,28 +465,9 @@ false - - - - - - - - - - - - ${CONTEXT_WEB}/owners/${count} - GET - true - false - true - false - false - - - - + + false saveConfig @@ -371,8 +499,9 @@ - - + + false saveConfig @@ -404,7 +533,7 @@ - +