From 240fa50d359f9a338be010c5f7f6af26bb881e2d Mon Sep 17 00:00:00 2001 From: Lindsey Wild <35239154+lindseywild@users.noreply.github.com> Date: Tue, 4 Jun 2024 09:16:45 -0400 Subject: [PATCH 1/4] Bumps relative-time-element version (#4638) * Bumps relative-time-element version * Updates package-lock.json file * Adds changeset --- .changeset/young-monkeys-sniff.md | 5 +++++ package-lock.json | 8 ++++---- packages/react/package.json | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 .changeset/young-monkeys-sniff.md diff --git a/.changeset/young-monkeys-sniff.md b/.changeset/young-monkeys-sniff.md new file mode 100644 index 00000000000..e73cd4d7b94 --- /dev/null +++ b/.changeset/young-monkeys-sniff.md @@ -0,0 +1,5 @@ +--- +'@primer/react': patch +--- + +Bumps @github/relative-time-element to v4.4.1 diff --git a/package-lock.json b/package-lock.json index fa027303a70..2913912053e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4959,9 +4959,9 @@ "license": "MIT" }, "node_modules/@github/relative-time-element": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/@github/relative-time-element/-/relative-time-element-4.3.1.tgz", - "integrity": "sha512-zL79nlhZVCg7x2Pf/HT5MB0mowmErE71VXpF10/3Wy8dQwkninNO1M9aOizh2wKC5LkSpDXqNYjDZwbH0/bcSg==" + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/@github/relative-time-element/-/relative-time-element-4.4.1.tgz", + "integrity": "sha512-E2vRcIgDj8AHv/iHpQMLJ/RqKOJ704OXkKw6+Zdhk3X+kVQhOf3Wj8KVz4DfCQ1eOJR8XxY6XVv73yd+pjMfXA==" }, "node_modules/@github/tab-container-element": { "version": "4.8.0", @@ -61914,7 +61914,7 @@ "@github/combobox-nav": "^2.1.5", "@github/markdown-toolbar-element": "^2.1.0", "@github/paste-markdown": "^1.4.0", - "@github/relative-time-element": "^4.1.2", + "@github/relative-time-element": "^4.4.1", "@github/tab-container-element": "^4.8.0", "@lit-labs/react": "1.2.1", "@oddbird/popover-polyfill": "^0.3.1", diff --git a/packages/react/package.json b/packages/react/package.json index 96d701a2ff4..f5235794221 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -88,7 +88,7 @@ "@github/combobox-nav": "^2.1.5", "@github/markdown-toolbar-element": "^2.1.0", "@github/paste-markdown": "^1.4.0", - "@github/relative-time-element": "^4.1.2", + "@github/relative-time-element": "^4.4.1", "@github/tab-container-element": "^4.8.0", "@lit-labs/react": "1.2.1", "@oddbird/popover-polyfill": "^0.3.1", From bd861cc779358fcb62fbcb48d2e76cdad90a9301 Mon Sep 17 00:00:00 2001 From: Lindsey Wild <35239154+lindseywild@users.noreply.github.com> Date: Wed, 5 Jun 2024 11:31:24 -0400 Subject: [PATCH 2/4] Adds `noTitle` option to RelativeTime component (#4635) * Adds noTitle option to RelativeTime component * Removes iconbutton story * Reverts package-lock.json changes * Adds changeset * Update packages/react/src/RelativeTime/RelativeTime.tsx Co-authored-by: Clay Miller * Update clever-pots-leave.md --------- Co-authored-by: Clay Miller Co-authored-by: Siddharth Kshetrapal --- .changeset/clever-pots-leave.md | 5 +++++ .../src/RelativeTime/RelativeTime.docs.json | 6 ++++++ .../RelativeTime.examples.stories.tsx | 19 +++++++++++++++++++ .../src/RelativeTime/RelativeTime.stories.tsx | 2 +- .../react/src/RelativeTime/RelativeTime.tsx | 4 ++-- .../react/src/__tests__/RelativeTime.test.tsx | 12 ++++++++++++ 6 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 .changeset/clever-pots-leave.md create mode 100644 packages/react/src/RelativeTime/RelativeTime.examples.stories.tsx diff --git a/.changeset/clever-pots-leave.md b/.changeset/clever-pots-leave.md new file mode 100644 index 00000000000..62b8d4a9fc1 --- /dev/null +++ b/.changeset/clever-pots-leave.md @@ -0,0 +1,5 @@ +--- +'@primer/react': minor +--- + +RelativeTime: Adds `noTitle` prop if you want to not render the `title` attribute with full date time. diff --git a/packages/react/src/RelativeTime/RelativeTime.docs.json b/packages/react/src/RelativeTime/RelativeTime.docs.json index c8c3d160767..8b1dfce9fd3 100644 --- a/packages/react/src/RelativeTime/RelativeTime.docs.json +++ b/packages/react/src/RelativeTime/RelativeTime.docs.json @@ -101,6 +101,12 @@ "name": "ref", "type": "React.RefObject" }, + { + "name": "noTitle", + "type": "boolean", + "defaultValue": "", + "description": "Removes the `title` attribute provided on the element by default" + }, { "name": "as", "type": "React.ElementType", diff --git a/packages/react/src/RelativeTime/RelativeTime.examples.stories.tsx b/packages/react/src/RelativeTime/RelativeTime.examples.stories.tsx new file mode 100644 index 00000000000..00c9228be72 --- /dev/null +++ b/packages/react/src/RelativeTime/RelativeTime.examples.stories.tsx @@ -0,0 +1,19 @@ +import React from 'react' +import RelativeTime from './RelativeTime' +import Link from '../Link' +import {Tooltip} from '../TooltipV2' + +export default { + title: 'Components/RelativeTime/Examples', + component: RelativeTime, +} + +export const NoTitleAttribute = () => + +export const LinkWithTooltip = () => ( + + + + + +) diff --git a/packages/react/src/RelativeTime/RelativeTime.stories.tsx b/packages/react/src/RelativeTime/RelativeTime.stories.tsx index e6bf26e64be..958db23cfa9 100644 --- a/packages/react/src/RelativeTime/RelativeTime.stories.tsx +++ b/packages/react/src/RelativeTime/RelativeTime.stories.tsx @@ -15,7 +15,7 @@ const meta: Meta = { }, } -export const Default: Story = () => +export const Default: Story = () => export const Playground: Story = args => { const {date, ...rest} = args diff --git a/packages/react/src/RelativeTime/RelativeTime.tsx b/packages/react/src/RelativeTime/RelativeTime.tsx index b33e8d79a45..10508e0930d 100644 --- a/packages/react/src/RelativeTime/RelativeTime.tsx +++ b/packages/react/src/RelativeTime/RelativeTime.tsx @@ -6,10 +6,10 @@ import {createComponent} from '../utils/create-component' const RelativeTimeComponent = createComponent(RelativeTimeElement, 'relative-time') const localeOptions: Intl.DateTimeFormatOptions = {month: 'short', day: 'numeric', year: 'numeric'} -function RelativeTime({date, datetime, children, ...props}: RelativeTimeProps) { +function RelativeTime({date, datetime, children, noTitle, ...props}: RelativeTimeProps) { if (datetime) date = new Date(datetime) return ( - + {children || date?.toLocaleDateString('en', localeOptions) || ''} ) diff --git a/packages/react/src/__tests__/RelativeTime.test.tsx b/packages/react/src/__tests__/RelativeTime.test.tsx index bf279a73b47..8fc5cef1885 100644 --- a/packages/react/src/__tests__/RelativeTime.test.tsx +++ b/packages/react/src/__tests__/RelativeTime.test.tsx @@ -37,4 +37,16 @@ describe('RelativeTime', () => { 'server rendered date', ]) }) + + it('does not render no-title attribute by default', () => { + const date = new Date('2024-03-07T12:22:48.123Z') + const {container} = HTMLRender() + expect(container.firstChild).not.toHaveAttribute('no-title') + }) + + it('adds no-title attribute if noTitle={true}', () => { + const date = new Date('2024-03-07T12:22:48.123Z') + const {container} = HTMLRender() + expect(container.firstChild).toHaveAttribute('no-title') + }) }) From 4552723c29a1b1f8a81715cb951a44ba04d712aa Mon Sep 17 00:00:00 2001 From: Kendall Gassner Date: Wed, 5 Jun 2024 08:43:08 -0700 Subject: [PATCH 3/4] Update TreeView default story to use prop `label` on TrailingVisual (#4643) * Update TreeView default story to use prop `label` on TrailingVisual ### What The `aria-label` on the Octicon in the default TreeView story is lost. The TrailingVisual only use the prop `label` as a means of aria-describing TreeView `li` component. * fix labels --- .../TreeView/TreeView.features.stories.tsx | 32 +++++++++---------- .../react/src/TreeView/TreeView.stories.tsx | 12 +++---- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/packages/react/src/TreeView/TreeView.features.stories.tsx b/packages/react/src/TreeView/TreeView.features.stories.tsx index 639fd6602e7..b4921f0d0fe 100644 --- a/packages/react/src/TreeView/TreeView.features.stories.tsx +++ b/packages/react/src/TreeView/TreeView.features.stories.tsx @@ -966,8 +966,8 @@ export const WithoutIndentation: Story = () => ( Avatar.tsx - - + + @@ -975,8 +975,8 @@ export const WithoutIndentation: Story = () => ( Button.tsx - - + + @@ -984,8 +984,8 @@ export const WithoutIndentation: Story = () => ( package.json - - + + @@ -1057,8 +1057,8 @@ export const MultilineItems: Story = () => ( Avatar.tsx - - + + @@ -1070,8 +1070,8 @@ export const MultilineItems: Story = () => (
this is a medium directory name that we wrap over 2 lines to demonstrate alignment
- - + + @@ -1079,8 +1079,8 @@ export const MultilineItems: Story = () => ( Avatar.tsx - - + + @@ -1097,8 +1097,8 @@ export const MultilineItems: Story = () => ( Avatar.tsx - - + + @@ -1114,8 +1114,8 @@ export const MultilineItems: Story = () => ( Avatar.tsx - - + + diff --git a/packages/react/src/TreeView/TreeView.stories.tsx b/packages/react/src/TreeView/TreeView.stories.tsx index 99c4226034d..3d0e102e8f7 100644 --- a/packages/react/src/TreeView/TreeView.stories.tsx +++ b/packages/react/src/TreeView/TreeView.stories.tsx @@ -33,8 +33,8 @@ export const Default: Story = () => ( Avatar.tsx - - + + @@ -42,8 +42,8 @@ export const Default: Story = () => ( Button.tsx - - + + @@ -53,8 +53,8 @@ export const Default: Story = () => ( package.json - - + + From cacc21a40b5a904b6da1a0dcbd11a2c4d774d75e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 5 Jun 2024 15:00:51 -0500 Subject: [PATCH 4/4] chore(deps): bump @primer/octicons-react from 17.12.0 to 19.9.0 (#4624) Bumps [@primer/octicons-react](https://github.com/primer/octicons) from 17.12.0 to 19.9.0. - [Release notes](https://github.com/primer/octicons/releases) - [Changelog](https://github.com/primer/octicons/blob/main/CHANGELOG.md) - [Commits](https://github.com/primer/octicons/compare/v17.12.0...v19.9.0) --- updated-dependencies: - dependency-name: "@primer/octicons-react" dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- docs/package.json | 2 +- package-lock.json | 13 +------------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/docs/package.json b/docs/package.json index 051039346b7..d71635b29e1 100644 --- a/docs/package.json +++ b/docs/package.json @@ -17,7 +17,7 @@ "@mdx-js/mdx": "1.6.22", "@mdx-js/react": "1.6.22", "@primer/gatsby-theme-doctocat": "0.0.0-2023930155223", - "@primer/octicons-react": "^17.7.0", + "@primer/octicons-react": "^19.9.0", "@primer/primitives": "4.1.0", "@styled-system/prop-types": "^5.1.0", "@styled-system/theme-get": "^5.1.0", diff --git a/package-lock.json b/package-lock.json index 2913912053e..362685d2cf8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -64,7 +64,7 @@ "@mdx-js/mdx": "1.6.22", "@mdx-js/react": "1.6.22", "@primer/gatsby-theme-doctocat": "0.0.0-2023930155223", - "@primer/octicons-react": "^17.7.0", + "@primer/octicons-react": "^19.9.0", "@primer/primitives": "4.1.0", "@styled-system/prop-types": "^5.1.0", "@styled-system/theme-get": "^5.1.0", @@ -94,17 +94,6 @@ "npm": ">=7" } }, - "docs/node_modules/@primer/octicons-react": { - "version": "17.12.0", - "resolved": "https://registry.npmjs.org/@primer/octicons-react/-/octicons-react-17.12.0.tgz", - "integrity": "sha512-GUjV6IT1Ck2lu2GVu1loR0e2dcX2e9aIVmX5rBdR7HJnRdYKY7XH+FnYj7y9sEmzUdNEDswxkefiQlfGrBXlzA==", - "engines": { - "node": ">=8" - }, - "peerDependencies": { - "react": ">=15" - } - }, "docs/node_modules/@primer/primitives": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/@primer/primitives/-/primitives-4.1.0.tgz",