From 7e2c9bb60e9384dfe54bbe30c39e0069367d4b8d Mon Sep 17 00:00:00 2001 From: Steven Spriggs Date: Mon, 16 Oct 2023 01:20:10 -0400 Subject: [PATCH] fix(cta): revert removal of colorPalette, deprecate instead (#1245) * fix(cta): revert removal of colorContext provider, deprecate instead * fix(cta): remove colorProvider, instead mock color-palette attribute * fix(cta): add mutation observer and deprecation warning * fix(cta): remove rogue file * chore(cta): add changeset * fix(cta): move deprecated code in a comment block, format jsdoc @attr * chore(cta): update decprecation comment block * chore(cta): update changeset * chore: whitespace and docs --------- Co-authored-by: Benny Powers --- .changeset/tough-trainers-fail.md | 5 ++++ elements/rh-cta/rh-cta.ts | 41 +++++++++++++++++++++++++++++-- 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 .changeset/tough-trainers-fail.md diff --git a/.changeset/tough-trainers-fail.md b/.changeset/tough-trainers-fail.md new file mode 100644 index 0000000000..2dc5a9b6d5 --- /dev/null +++ b/.changeset/tough-trainers-fail.md @@ -0,0 +1,5 @@ +--- +"@rhds/elements": patch +--- + +``: adds `color-palette` attribute back with deprecation notice diff --git a/elements/rh-cta/rh-cta.ts b/elements/rh-cta/rh-cta.ts index c2b4b126fa..6057bd52a3 100644 --- a/elements/rh-cta/rh-cta.ts +++ b/elements/rh-cta/rh-cta.ts @@ -7,6 +7,7 @@ import { Logger } from '@patternfly/pfe-core/controllers/logger.js'; import { DirController } from '../../lib/DirController.js'; +import { type ColorPalette } from 'lib/context/color/provider.js'; import { colorContextConsumer, type ColorTheme } from '../../lib/context/color/consumer.js'; import style from './rh-cta.css'; @@ -40,7 +41,15 @@ function isButton(element: Element): element is HTMLButtonElement { * * @summary Directs users to other pages or displays extra content * @slot - * We expect an anchor tag, `` with an `href`, to be the first child inside `rh-cta` element. Less preferred but allowed for specific use-cases include: `