diff --git a/.circleci/config.yml b/.circleci/config.yml index 30c026c66..fdee175a9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -19,6 +19,10 @@ jobs: - run: name: Lint command: npm run lint + # TODO uncomment when hexcodes are removed from stylesheets + # - run: + # name: Run Stylelint + # command: npm run lint:styles workflows: version: 2 diff --git a/.stylelintrc b/.stylelintrc new file mode 100644 index 000000000..667bbe467 --- /dev/null +++ b/.stylelintrc @@ -0,0 +1,5 @@ +{ + "rules": { + "color-no-hex": true + } +} \ No newline at end of file diff --git a/package.json b/package.json index cfa5b6d83..77a48caf9 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,8 @@ "storybook": "storybook dev -p 6006 --ci", "build-storybook": "storybook build", "jest": "node --expose-gc --no-compilation-cache ./node_modules/.bin/jest --logHeapUsage --maxWorkers=1", - "jest:watch": "jest --watch" + "jest:watch": "jest --watch", + "lint:styles": "stylelint '**/*.scss'" }, "dependencies": { "@pdftron/webviewer-react-toolkit": "^0.7.11", @@ -99,10 +100,10 @@ "cssnano": "^4.1.11", "eslint": "^6.8.0", "eslint-plugin-babel": "^5.3.0", + "eslint-plugin-custom": "file:eslint-plugin-custom", "eslint-plugin-cypress": "^2.8.1", "eslint-plugin-import": "^2.20.0", "eslint-plugin-jsx-a11y": "^6.2.3", - "eslint-plugin-custom": "file:eslint-plugin-custom", "eslint-plugin-no-unsanitized": "^4.0.2", "eslint-plugin-react": "^7.18.0", "eslint-plugin-react-hooks": "^2.3.0", @@ -133,6 +134,7 @@ "storybook": "^8.1.0", "storybook-addon-pseudo-states": "^3.1.1", "style-loader": "^1.1.3", + "stylelint": "^13.13.1", "svg-inline-loader": "^0.8.0", "typescript": "^5.4.5", "webpack": "^5.91.0", diff --git a/src/constants/dark.scss b/src/constants/dark.scss index 9afe9a0fd..dd8004fdd 100644 --- a/src/constants/dark.scss +++ b/src/constants/dark.scss @@ -1,4 +1,5 @@ :root { + /* stylelint-disable color-no-hex */ --blue-1: #192530; --blue-2: #1B2B3A; --blue-3: #334250; @@ -22,6 +23,7 @@ --yellow-1: #e1b90080; --red: red; + /* stylelint-enable color-no-hex */ --panel-background: var(--gray-3); --faded-component-background: var(--gray-1); @@ -78,6 +80,8 @@ --image-signature-drop-background: var(--blue-1); --image-signature-drop-border: var(--blue-6); + --file-picker-drop-background: var(--blue-1); + --file-picker-drop-border: var(--blue-6); --signature-draw-background: var(--gray-3); --modal-stroke-and-border: var(--gray-4); --modal-negative-space: rgba(0, 0, 0, 0.3); @@ -104,4 +108,12 @@ --outline-color: var(--blue-6); --outline-hover: var(--blue-3); --outline-selected: var(--blue-3); -} + + --scale-overlay-item-hover: var(--blue-3); + + --oe-table-dropdown-highlight: var(--blue-5); + + --bookmark-outline-hover-border: transparent; + + --checked-option: var(--blue-6); +} \ No newline at end of file diff --git a/src/constants/highContrastDark.scss b/src/constants/highContrastDark.scss index 9ff92de34..0e892b39d 100644 --- a/src/constants/highContrastDark.scss +++ b/src/constants/highContrastDark.scss @@ -1,4 +1,5 @@ :root { + /* stylelint-disable color-no-hex */ --blue-1: #192530; --blue-2: #1B2B3A; --blue-3: #334250; @@ -23,6 +24,7 @@ --yellow-1: #e1b90080; --red: red; + /* stylelint-enable color-no-hex */ --panel-background: var(--gray-3); --faded-component-background: var(--gray-1); @@ -100,4 +102,10 @@ --outline-color: var(--blue-7); --outline-hover: var(--blue-3); -} + + --oe-table-dropdown-highlight: var(--blue-5); + + --bookmark-outline-hover-border: transparent; + + --checked-option: var(--blue-6); +} \ No newline at end of file diff --git a/src/constants/highContrastLight.scss b/src/constants/highContrastLight.scss index be1b45912..9b9f8c303 100644 --- a/src/constants/highContrastLight.scss +++ b/src/constants/highContrastLight.scss @@ -1,4 +1,5 @@ :root { + /* stylelint-disable color-no-hex */ --blue-1: #E7EDF3; --blue-2: #DDE6EE; --blue-3: #CFD8E0; @@ -23,6 +24,7 @@ --yellow-1: #FACE0080; --red: red; + /* stylelint-enable color-no-hex */ --component-background: var(--gray-0); --mobile-presets-background: var(--gray-1); @@ -103,4 +105,10 @@ --outline-hover: var(--blue-1); --preset-background: var(--gray-1); -} + + --oe-table-dropdown-highlight: var(--blue-4); + + --bookmark-outline-hover-border: transparent; + + --checked-option: var(--blue-5); +} \ No newline at end of file diff --git a/src/constants/light.scss b/src/constants/light.scss index dca15e63a..24cfca41c 100644 --- a/src/constants/light.scss +++ b/src/constants/light.scss @@ -1,4 +1,5 @@ :root { + /* stylelint-disable color-no-hex */ --blue-1: #E7EDF3; --blue-2: #DDE6EE; --blue-3: #CFD8E0; @@ -22,6 +23,7 @@ --yellow-1: #FACE0080; --red: red; + /* stylelint-enable color-no-hex */ --component-background: var(--gray-0); --mobile-presets-background: var(--gray-1); diff --git a/src/constants/lightWCAG.scss b/src/constants/lightWCAG.scss index a91e800a7..172f362bc 100644 --- a/src/constants/lightWCAG.scss +++ b/src/constants/lightWCAG.scss @@ -1,4 +1,5 @@ :root { + /* stylelint-disable color-no-hex */ --blue-1: #E7EDF3; --blue-2: #DDE6EE; --blue-3: #CFD8E0; @@ -23,6 +24,7 @@ --yellow-1: #FACE0080; --red: #D52A2A; + /* stylelint-enable color-no-hex */ --component-background: var(--gray-0); --mobile-presets-background: var(--gray-1); diff --git a/src/constants/styles.scss b/src/constants/styles.scss index cac813eb6..cf5b49b65 100644 --- a/src/constants/styles.scss +++ b/src/constants/styles.scss @@ -35,6 +35,7 @@ $button-width-m: 41px; $button-height-m: 41px; $search-overlay-height-m: 61px; +/* stylelint-disable color-no-hex */ // TODO: Remove // Old Colors $white: #fff; @@ -61,6 +62,7 @@ $headers-z-index: 72; // Dark defaults for new ui: $gray-3: #343A40; $light-gray: #e7ebee; +/* stylelint-enable color-no-hex */ %open { &.open { diff --git a/src/index.scss b/src/index.scss index 9a0c70943..1fa289a8f 100644 --- a/src/index.scss +++ b/src/index.scss @@ -26,6 +26,7 @@ /* copied from webviewer react toolkit for shadow dom */ :host { + /* stylelint-disable color-no-hex */ --color-theme-primary: #00a5e4; --color-theme-secondary: #242933; --color-font-primary: #232229; @@ -47,11 +48,13 @@ --color-message-success: #27ae60; --color-message-warning: #e67e22; --color-message-error: #e74c3c; + --color-background-canvas: #eee; + /* stylelint-enable color-no-hex */ + --color-message-info-focus-shadow: rgba(41, 128, 185, 0.4); --color-message-success-focus-shadow: rgba(39, 174, 96, 0.4); --color-message-warning-focus-shadow: rgba(230, 126, 34, 0.4); --color-message-error-focus-shadow: rgba(231, 76, 60, 0.4); - --color-background-canvas: #eee; --color-focus-shadow: rgba(20, 110, 170, 0.4); --color-overlay-canvas: rgba(0, 0, 0, 0.4); --font-size-tiny: 9px;