Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: chansey #1461

Merged
merged 23 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
cc7a532
docs: draft release notes
bennypowers Jan 25, 2024
441a78c
fix(tabs): improve long tab content with container queries (#1411)
zeroedin Feb 13, 2024
b415fbb
Merge branch 'main' into staging/chansey
zeroedin Mar 6, 2024
5ce0e5e
Merge branch 'main' into staging/chansey
bennypowers Mar 28, 2024
f2ebf8e
Merge branch 'main' into staging/chansey
zeroedin Apr 13, 2024
ab3d921
feat(skip-link): add `<rh-skip-link>` (#1515)
adamjohnson Apr 14, 2024
b049b5c
feat(back-to-top): add `<rh-back-to-top>` (#1517)
zeroedin Apr 14, 2024
0be8bc1
fix!: context types (#1518)
bennypowers Apr 16, 2024
fa90335
feat(code-block): actions and line numbers (#1496)
bennypowers Apr 16, 2024
2660b6b
chore: update to @patternfly/pfe-core version 3.0 (#1508)
zeroedin Apr 17, 2024
ad54f15
chore: eslint 9 (#1523)
bennypowers Apr 18, 2024
b28c881
feat(site-status): add `<rh-site-status>` (#1507)
zeroedin Apr 18, 2024
a4fd015
docs: update .changeset/witty-papayas-tease.md
bennypowers Apr 18, 2024
fc63b77
style: lint
bennypowers Apr 18, 2024
ba04047
feat: react wrappers (#1527)
bennypowers Apr 18, 2024
dfabf0b
docs: add Get started: Developers (#1439)
marionnegp Apr 18, 2024
3c58a7d
docs: add <rh-back-to-top> content (#1526)
marionnegp Apr 18, 2024
d2503d1
fix(alert): body copy and button color (#1521)
marionnegp Apr 18, 2024
42ca8d2
fix(menu): improve keyboard accessibility on firefox (#1529)
zeroedin Apr 22, 2024
d922cbe
fix: adds accents slot to rh-accordion-header (#1505)
diwanshi Apr 22, 2024
4030409
docs(tag): fix broken icons (#1531)
zeroedin Apr 22, 2024
8de1f0b
chore: add a lit 3 patch changeset (#1533)
zeroedin Apr 22, 2024
5735abd
docs: Chansey release notes (#1532)
markcaron Apr 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .changeset/free-lizards-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
"@rhds/elements": minor
---
`<rh-codeblock>`: added line numbers
11 changes: 11 additions & 0 deletions .changeset/hot-spiders-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@rhds/elements": minor
---

✨ Added `<rh-site-status>`

Website status communicates the operational status of a website or domain using a status icon and link. It is usually located in the Footer component.

```html
<rh-site-status></rh-site-status>
```
6 changes: 6 additions & 0 deletions .changeset/large-kings-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@rhds/elements": patch
---

`<rh-menu>`: improved focus accessibility for keyboard navigation users on firefox
`<rh-button>`: improved focus accessibility on firefox
11 changes: 11 additions & 0 deletions .changeset/late-cobras-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@rhds/elements": minor
---

✨ Added `<rh-back-to-top>`.

Back to top component is a fragment link that allows users to quickly navigate to the top of a lengthy content.

```html
<rh-back-to-top href="#top">Back to top</rh-back-to-top>
```
5 changes: 5 additions & 0 deletions .changeset/lemon-comics-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rhds/elements": patch
---

`<rh-accordion>`: added a accents slot with placement options as inline and bottom
5 changes: 5 additions & 0 deletions .changeset/light-rice-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rhds/elements": patch
---

Context: aligned context implementation with updated [protocol defintions](https://github.com/webcomponents-cg/community-protocols/blob/main/proposals/context.md#definitions)
5 changes: 5 additions & 0 deletions .changeset/nervous-hairs-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rhds/elements": patch
---

Update dependencies, including Lit version 3
5 changes: 5 additions & 0 deletions .changeset/new-grapes-hope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rhds/elements": patch
---

`<rh-alert>`: make sure alerts always have to correct (lightest) colour palette
5 changes: 5 additions & 0 deletions .changeset/silver-hornets-cry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rhds/elements": patch
---

`<rh-tabs>`: allow tabs with long text content to fit into different-sized containers
13 changes: 13 additions & 0 deletions .changeset/slow-drinks-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
"@rhds/elements": minor
---

✨ Added `<rh-skip-link>`.

A skip link is used to skip repetitive content on a page. It is hidden by default and can be activated by hitting the "Tab" key after loading/refreshing a page.

```html
<rh-skip-link>
<a href="#main-content">Skip to main content</a>
</rh-skip-link>
```
38 changes: 38 additions & 0 deletions .changeset/spicy-cups-fly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
"@rhds/elements": minor
---
⚛️ Added React wrapper components

You can now more easily integrate RHDS elements into your React apps by importing our wrapper components

First, make sure that you list `@lit/react` as a dependency in your project

```sh
npm install --save @lit/react
```

Then import the element components you need and treat them like any other react component

```js
import { Tabs } from '@rhds/elements/react/rh-tabs/rh-tabs.js';
import { Tab } from '@rhds/elements/react/rh-tabs/rh-tab.js';
import { TabPanel } from '@rhds/elements/react/rh-tabs/rh-tab-panel.js';

import { useState } from 'react';

const tabs = [
{ heading: 'Hello Red Hat', content: 'Let\'s break down silos' },
{ heading: 'Web components', content: 'They work everywhere' }
];

function App() {
const [index, setExpanded] = useState(-1);
return (
<span>expanded {expanded}</span>
<Tabs>{tabs.map(({ heading, content }, i) => (
<Tab slot="tab" onExpand={() => setExpanded(i)}>{heading}</Tab>
<TabPanel>{content}</TabPanel>))}
</Tabs>
);
}
```
4 changes: 4 additions & 0 deletions .changeset/tame-comics-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
"@rhds/elements": minor
---
`<rh-codeblock>`: added `Show more` toggle
16 changes: 16 additions & 0 deletions .changeset/witty-papayas-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
"@rhds/elements": minor
---
`<rh-codeblock>`: added copy and wrap actions, with localizable slots for the button labels

```html
<rh-code-block actions="wrap copy">
<span slot="action-label-copy">Copy to Clipboard</span>
<span slot="action-label-copy" hidden data-code-block-state="active">Copied!</span>
<span slot="action-label-wrap">Toggle word wrap</span>
<span slot="action-label-wrap" hidden data-code-block-state="active">Toggle overflow</span>
<script type="text/css">:host {
display: block;
}</script>
</rh-code-block>
```
55 changes: 0 additions & 55 deletions .eslintignore

This file was deleted.

12 changes: 0 additions & 12 deletions .eslintrc.json

This file was deleted.

3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ jobs:

- name: Install dependencies
run: npm ci --prefer-offline

- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Lint
id: lint
run: npm run lint
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ docs/assets/playgrounds/
# Build artifacts
elements/*/*.js
elements/*/test/*.js
react
lib/**/*.js
!elements/**/demo/*.css
*.map
Expand Down
14 changes: 7 additions & 7 deletions .markdownlint-cli2.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ export default {
description: 'Require changesets to use the correct package name',
tags: ['frontmatter'],
function({ name, frontMatterLines, ...rest }, onError) {
const yaml = YAML.load(frontMatterLines.filter(Boolean).filter(x => x !== '---'))
const yaml = YAML.load(frontMatterLines.filter(Boolean).filter(x => x !== '---'));
for (const [key, value] of Object.entries(yaml)) {
if (['patch','minor','major'].includes(value)) {
if (['patch', 'minor', 'major'].includes(value)) {
if (key !== '@rhds/elements') {
onError({
lineNumber: 2,
detail: `incorrect package name ${key}`,
})
});
}
}
}
}
},
}],
dot: true,
files: './changeset/*.md',
config: {
default: false,
'default': false,
'markdownlint-changeset-packagename': true,
}
}
},
};
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.12.1
v20.10.0
5 changes: 1 addition & 4 deletions declaration.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
declare module '*.css' {
import type { CSSResult } from 'lit';

// import style from './some-styles.css';
const style: CSSResult;
const style: CSSStyleSheet
export default style;
}

Expand Down
53 changes: 30 additions & 23 deletions docs/_data/playgrounds.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ function groupBy(prop, xs) {

function getDemoFilename(x) {
return `demo/${(x.url.split('/demo/').pop() || `${x.primaryElementName}.html`).replace(/\/$/, '.html')}`
.replace('.html', '/index.html')
.replace(`${x.primaryElementName}/index.html`, 'index.html');
.replace('.html', '/index.html')
.replace(`${x.primaryElementName}/index.html`, 'index.html');
}

/**
Expand All @@ -26,7 +26,8 @@ function getDemoFilename(x) {
* > One of `.`, or **WORD** (_>= 1x_)
* `"`
*/
const DEMO_SUBRESOURCE_RE = /(?<attr>href|src)="\/elements\/rh-(?<unprefixed>.*)\/(?<filename>.*)\.(?<extension>[.\w]+)"/g;
const DEMO_SUBRESOURCE_RE =
/(?<attr>href|src)="\/elements\/rh-(?<unprefixed>.*)\/(?<filename>.*)\.(?<extension>[.\w]+)"/g;

/**
* `/elements/`
Expand Down Expand Up @@ -63,16 +64,16 @@ function demoPaths(content, pathname) {

function isModuleScript(node) {
return (
node.tagName === 'script' &&
node.attrs.some(x => x.name === 'type' && x.value === 'module')
node.tagName === 'script'
&& node.attrs.some(x => x.name === 'type' && x.value === 'module')
);
}

function isStyleLink(node) {
return (
node.tagName === 'link' &&
node.attrs.some(x => x.name === 'rel' && x.value === 'stylesheet') &&
node.attrs.some(x => x.name === 'href')
node.tagName === 'link'
&& node.attrs.some(x => x.name === 'rel' && x.value === 'stylesheet')
&& node.attrs.some(x => x.name === 'href')
);
}

Expand Down Expand Up @@ -130,11 +131,11 @@ module.exports = async function(data) {
Tools.createCommentNode('playground-fold'),
Tools.createElement('link', {
rel: 'stylesheet',
href: 'https://static.redhat.com/libs/redhat/redhat-font/4/webfonts/red-hat-font.min.css'
href: 'https://static.redhat.com/libs/redhat/redhat-font/4/webfonts/red-hat-font.min.css',
}),
Tools.createElement('link', {
rel: 'stylesheet',
href: 'https://static.redhat.com/libs/redhat/redhat-theme/6/advanced-theme.css'
href: 'https://static.redhat.com/libs/redhat/redhat-theme/6/advanced-theme.css',
}),
Tools.createElement('link', {
rel: 'stylesheet',
Expand All @@ -147,17 +148,19 @@ module.exports = async function(data) {
const filename = getDemoFilename(demo);

/** @see docs/_plugins/rhds.cjs demoPaths transform */
const base = url.pathToFileURL(path.join(process.cwd(), 'elements', primaryElementName, 'demo/'));
const base = url.pathToFileURL(path.join(process.cwd(),
'elements',
primaryElementName,
'demo/'));
const docsDir = url.pathToFileURL(path.join(process.cwd(), 'docs/'));
const isMainDemo = filename === 'demo/index.html';
const demoSlug = filename.split('/').at(1);

const addSubresourceURL = async subresourceURL => {
if (subresourceURL && !subresourceURL.startsWith('http')) {
const subresourceFileURL = !subresourceURL.startsWith('/')
const subresourceFileURL = !subresourceURL.startsWith('/') ?
// non-tabular ternary
// eslint-disable-next-line operator-linebreak
? new URL(subresourceURL, base)
new URL(subresourceURL, base)
: new URL(subresourceURL.replace('/', './'), docsDir);
try {
const resourceName =
Expand All @@ -171,7 +174,11 @@ module.exports = async function(data) {
fileMap.set(resourceName, { content, hidden: true });
}
} catch (e) {
throw new SubresourceError(`Error generating playground for ${demo.slug}.\nCould not find subresource ${subresourceURL} at ${subresourceFileURL?.href ?? 'unknown'}`, e, subresourceFileURL);
throw new SubresourceError(
`Error generating playground for ${demo.slug}.\nCould not find subresource ${subresourceURL} at ${subresourceFileURL?.href ?? 'unknown'}`,
e,
subresourceFileURL,
);
}
}
};
Expand All @@ -183,13 +190,13 @@ module.exports = async function(data) {
});

const hrefSubresourceElements = Tools.queryAll(fragment, node =>
Tools.isElementNode(node) &&
isStyleLink(node));
Tools.isElementNode(node)
&& isStyleLink(node));

const srcSubresourceElements = Tools.queryAll(fragment, node =>
Tools.isElementNode(node) &&
SRC_SUBRESOURCE_TAGNAMES.has(node.tagName) &&
hasLocalSrcAttr(node));
Tools.isElementNode(node)
&& SRC_SUBRESOURCE_TAGNAMES.has(node.tagName)
&& hasLocalSrcAttr(node));

// register demo css resources
for (const el of hrefSubresourceElements) {
Expand Down Expand Up @@ -219,9 +226,9 @@ module.exports = async function(data) {
// HACK: https://github.com/google/playground-elements/issues/93#issuecomment-1775247123
const inlineModules =
Tools.queryAll(fragment, node =>
Tools.isElementNode(node) &&
isModuleScript(node) &&
!node.attrs.some(({ name }) => name === 'src'));
Tools.isElementNode(node)
&& isModuleScript(node)
&& !node.attrs.some(({ name }) => name === 'src'));

Array.from(inlineModules).forEach((el, i) => {
const moduleName = `${primaryElementName}-${demoSlug.replace('.html', '')}-inline-script-${i++}.js`;
Expand Down
Loading
Loading