From 358d7b7daf13248bf34ac4135a0d4256efba1284 Mon Sep 17 00:00:00 2001 From: Benjamin Charity Date: Fri, 23 Aug 2019 14:52:52 -0400 Subject: [PATCH 01/17] chore: Update changelog verbiage update to match existing format --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5c0eb9a01..118dc4059 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ### Bug Fixes -* **date-range:** fix invalid date range when changing text ([ac0156e](https://github.com/GetTerminus/terminus-ui/commit/ac0156e)) +* **DateRange:** user can now manually adjust date without potentially entering an erred state ([ac0156e](https://github.com/GetTerminus/terminus-ui/commit/ac0156e)) ## [14.8.3](https://github.com/GetTerminus/terminus-ui/compare/v14.8.2...v14.8.3) (2019-08-23) From 83f2174636d0e25f94143ffe8b15accd1938c217 Mon Sep 17 00:00:00 2001 From: Benjamin Charity Date: Mon, 26 Aug 2019 08:49:12 -0400 Subject: [PATCH 02/17] chore: add workflow to label approved PRs --- .github/workflows/label-approved-prs.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/label-approved-prs.yml diff --git a/.github/workflows/label-approved-prs.yml b/.github/workflows/label-approved-prs.yml new file mode 100644 index 000000000..e69503032 --- /dev/null +++ b/.github/workflows/label-approved-prs.yml @@ -0,0 +1,17 @@ +name: Label Approved PRs + +on: [pull_request_review] + +jobs: + trigger-label: + runs-on: ubuntu-latest + + steps: + - name: Label approved pull requests + uses: pullreminders/label-when-approved-action@v1.0.3 + with: + secrets = ["GITHUB_TOKEN"] + env = { + LABEL_NAME = "Status: ready to merge" + APPROVALS = "2" + } From d9e9c7b59b7a765f4da65e6d811fa46020361dc9 Mon Sep 17 00:00:00 2001 From: Benjamin Charity Date: Mon, 26 Aug 2019 09:09:43 -0400 Subject: [PATCH 03/17] =?UTF-8?q?=F0=9F=9A=A7=20WIP=20[ci=20skip]=20?= =?UTF-8?q?=F0=9F=9A=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/label-approved-prs.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/label-approved-prs.yml b/.github/workflows/label-approved-prs.yml index e69503032..6daeabe7e 100644 --- a/.github/workflows/label-approved-prs.yml +++ b/.github/workflows/label-approved-prs.yml @@ -5,13 +5,11 @@ on: [pull_request_review] jobs: trigger-label: runs-on: ubuntu-latest - + steps: - name: Label approved pull requests uses: pullreminders/label-when-approved-action@v1.0.3 - with: - secrets = ["GITHUB_TOKEN"] - env = { - LABEL_NAME = "Status: ready to merge" - APPROVALS = "2" - } + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + APPROVALS: 2 + LABEL_NAME: "Status: ready to merge" From 585e4df056a62eabbb5b255e4d87e97b1c3ed56f Mon Sep 17 00:00:00 2001 From: Benjamin Charity Date: Mon, 26 Aug 2019 09:13:31 -0400 Subject: [PATCH 04/17] WIP: change to 1 approval for testing --- .github/workflows/label-approved-prs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/label-approved-prs.yml b/.github/workflows/label-approved-prs.yml index 6daeabe7e..a995e0fb8 100644 --- a/.github/workflows/label-approved-prs.yml +++ b/.github/workflows/label-approved-prs.yml @@ -11,5 +11,5 @@ jobs: uses: pullreminders/label-when-approved-action@v1.0.3 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - APPROVALS: 2 + APPROVALS: 1 LABEL_NAME: "Status: ready to merge" From ac5b2a9ce93cebd224696306566a04612f12990a Mon Sep 17 00:00:00 2001 From: Benjamin Charity Date: Mon, 26 Aug 2019 09:40:31 -0400 Subject: [PATCH 05/17] fix: try small format changes --- .github/workflows/label-approved-prs.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/label-approved-prs.yml b/.github/workflows/label-approved-prs.yml index a995e0fb8..d0a4890ed 100644 --- a/.github/workflows/label-approved-prs.yml +++ b/.github/workflows/label-approved-prs.yml @@ -1,15 +1,13 @@ -name: Label Approved PRs - -on: [pull_request_review] +name: "Label Approved PRs" +on: pull_request_review jobs: trigger-label: runs-on: ubuntu-latest - steps: - - name: Label approved pull requests - uses: pullreminders/label-when-approved-action@v1.0.3 + - uses: pullreminders/label-when-approved-action@v1.0.3 + - name: "Label approved pull requests" env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - APPROVALS: 1 + APPROVALS: "1" + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" LABEL_NAME: "Status: ready to merge" From 9401cefb13404ee98288eefe1ecf9084d3aca1b7 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 26 Aug 2019 14:06:09 +0000 Subject: [PATCH 06/17] =?UTF-8?q?=F0=9F=93=9A=20Add=2014.8.5=20release=20n?= =?UTF-8?q?otes=20[skip=20ci]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 118dc4059..d1761a07c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [14.8.5](https://github.com/GetTerminus/terminus-ui/compare/v14.8.4...v14.8.5) (2019-08-26) + + +### Bug Fixes + +* try small format changes ([ac5b2a9](https://github.com/GetTerminus/terminus-ui/commit/ac5b2a9)) + ## [14.8.4](https://github.com/GetTerminus/terminus-ui/compare/v14.8.3...v14.8.4) (2019-08-23) From 7344288f0e9cde96dd3a318c839415cbca6abaad Mon Sep 17 00:00:00 2001 From: Benjamin Charity Date: Mon, 26 Aug 2019 10:33:25 -0400 Subject: [PATCH 07/17] chore: update pr label workflow --- .github/workflows/label-approved-prs.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/label-approved-prs.yml b/.github/workflows/label-approved-prs.yml index d0a4890ed..33f68eb7e 100644 --- a/.github/workflows/label-approved-prs.yml +++ b/.github/workflows/label-approved-prs.yml @@ -1,13 +1,14 @@ -name: "Label Approved PRs" on: pull_request_review +name: "Label Approved PRs" + jobs: trigger-label: + name: "Add label to approved PR" runs-on: ubuntu-latest steps: - - uses: pullreminders/label-when-approved-action@v1.0.3 - - name: "Label approved pull requests" - env: - APPROVALS: "1" - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - LABEL_NAME: "Status: ready to merge" + - uses: pullreminders/label-when-approved-action@v1.0.3 + env: + APPROVALS: "1" + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + LABEL_NAME: "Status: ready to merge" From 6659df15172d51f2bca959fb76de7cb66ed08094 Mon Sep 17 00:00:00 2001 From: Benjamin Charity Date: Mon, 26 Aug 2019 10:35:59 -0400 Subject: [PATCH 08/17] chore: remove name from workflow --- .github/workflows/label-approved-prs.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/label-approved-prs.yml b/.github/workflows/label-approved-prs.yml index 33f68eb7e..b497657c3 100644 --- a/.github/workflows/label-approved-prs.yml +++ b/.github/workflows/label-approved-prs.yml @@ -4,7 +4,6 @@ name: "Label Approved PRs" jobs: trigger-label: - name: "Add label to approved PR" runs-on: ubuntu-latest steps: - uses: pullreminders/label-when-approved-action@v1.0.3 From 0c8bc068124f82c5925da016156253b46ecacacd Mon Sep 17 00:00:00 2001 From: Benjamin Charity Date: Mon, 26 Aug 2019 10:39:31 -0400 Subject: [PATCH 09/17] chore: unquote workflow token --- .github/workflows/label-approved-prs.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/label-approved-prs.yml b/.github/workflows/label-approved-prs.yml index b497657c3..9c2aeaa5c 100644 --- a/.github/workflows/label-approved-prs.yml +++ b/.github/workflows/label-approved-prs.yml @@ -1,13 +1,11 @@ -on: pull_request_review - name: "Label Approved PRs" +on: pull_request_review jobs: trigger-label: - runs-on: ubuntu-latest steps: - uses: pullreminders/label-when-approved-action@v1.0.3 env: APPROVALS: "1" - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} LABEL_NAME: "Status: ready to merge" From 8432b2271b4ee8948e623fd562008ccfe5f9aa49 Mon Sep 17 00:00:00 2001 From: Benjamin Charity Date: Mon, 26 Aug 2019 10:49:00 -0400 Subject: [PATCH 10/17] chore: pr workflow syntax adjustments --- .github/workflows/label-approved-prs.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/label-approved-prs.yml b/.github/workflows/label-approved-prs.yml index 9c2aeaa5c..11a7a7383 100644 --- a/.github/workflows/label-approved-prs.yml +++ b/.github/workflows/label-approved-prs.yml @@ -2,10 +2,12 @@ name: "Label Approved PRs" on: pull_request_review jobs: - trigger-label: + label: + runs-on: ubuntu-latest steps: - - uses: pullreminders/label-when-approved-action@v1.0.3 + - name: Label + uses: pullreminders/label-when-approved-action@v1.0.3 env: - APPROVALS: "1" + APPROVALS: ${{ 1 }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - LABEL_NAME: "Status: ready to merge" + LABEL_NAME: ${{ 'Status: ready to merge' }} From d51bbae943c1eafb11022aa55f1149ebdc9be61e Mon Sep 17 00:00:00 2001 From: Benjamin Charity Date: Mon, 26 Aug 2019 11:02:21 -0400 Subject: [PATCH 11/17] chore: workflow add name property --- .github/workflows/label-approved-prs.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/label-approved-prs.yml b/.github/workflows/label-approved-prs.yml index 11a7a7383..81755532f 100644 --- a/.github/workflows/label-approved-prs.yml +++ b/.github/workflows/label-approved-prs.yml @@ -1,13 +1,13 @@ name: "Label Approved PRs" -on: pull_request_review +on: [pull_request_review] jobs: - label: + build: runs-on: ubuntu-latest steps: - - name: Label - uses: pullreminders/label-when-approved-action@v1.0.3 - env: - APPROVALS: ${{ 1 }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - LABEL_NAME: ${{ 'Status: ready to merge' }} + - name: Label approved pull requests + uses: pullreminders/label-when-approved-action@v1.0.3 + env: + APPROVALS: ${{ 1 }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + LABEL_NAME: ${{ 'Status: ready to merge' }} From 4251bf77645b5c05503bfdd7e12773eb1b19698d Mon Sep 17 00:00:00 2001 From: Benjamin Charity Date: Thu, 22 Aug 2019 15:40:04 -0400 Subject: [PATCH 12/17] docs(Autocomplete): update to ToC that was missed in previous release --- terminus-ui/autocomplete/src/autocomplete.component.md | 1 + 1 file changed, 1 insertion(+) diff --git a/terminus-ui/autocomplete/src/autocomplete.component.md b/terminus-ui/autocomplete/src/autocomplete.component.md index e391a1666..861afea8c 100644 --- a/terminus-ui/autocomplete/src/autocomplete.component.md +++ b/terminus-ui/autocomplete/src/autocomplete.component.md @@ -10,6 +10,7 @@ - [Keep Panel Open After Selection](#keep-panel-open-after-selection) - [Debouncing](#debouncing) - [Minimum Characters](#minimum-characters) +- [Formatting options](#formatting-options) - [Test Helpers](#test-helpers) From c835f5d7833f5c67b551879d8824530291ab81aa Mon Sep 17 00:00:00 2001 From: Benjamin Charity Date: Thu, 15 Aug 2019 07:10:45 -0400 Subject: [PATCH 13/17] feat(Copy): support for 'minimal' and 'icon' modes Closes #848 --- demo/app/components/copy/copy.component.html | 22 ++- demo/app/components/copy/copy.component.ts | 11 +- terminus-ui/copy/src/copy.component.html | 42 ++--- terminus-ui/copy/src/copy.component.scss | 170 +++++++++++++++--- terminus-ui/copy/src/copy.component.spec.ts | 46 +++-- terminus-ui/copy/src/copy.component.ts | 68 +++++-- terminus-ui/scss/helpers/_scrollbars.scss | 29 +++ .../tooltip/src/tooltip.component.scss | 2 + .../utilities/src/error/ui-error.spec.ts | 18 ++ terminus-ui/utilities/src/error/ui-error.ts | 11 ++ terminus-ui/utilities/src/utilities.module.ts | 1 + 11 files changed, 345 insertions(+), 75 deletions(-) create mode 100644 terminus-ui/utilities/src/error/ui-error.spec.ts create mode 100644 terminus-ui/utilities/src/error/ui-error.ts diff --git a/demo/app/components/copy/copy.component.html b/demo/app/components/copy/copy.component.html index a985f1e07..f5b6910e7 100644 --- a/demo/app/components/copy/copy.component.html +++ b/demo/app/components/copy/copy.component.html @@ -7,10 +7,30 @@

Enable quick copy: +
+ + +
+ + - + {{ fakeUrl }} diff --git a/demo/app/components/copy/copy.component.ts b/demo/app/components/copy/copy.component.ts index 80883d881..65c2c2984 100644 --- a/demo/app/components/copy/copy.component.ts +++ b/demo/app/components/copy/copy.component.ts @@ -1,4 +1,5 @@ import { Component } from '@angular/core'; +import { TsStyleThemeTypes } from '@terminus/ui/utilities'; @Component({ @@ -6,8 +7,10 @@ import { Component } from '@angular/core'; templateUrl: './copy.component.html', }) export class CopyComponent { - // tslint:disable: max-line-length - fakeUrl = 'https://github.com/foo/bar/baz/bing/bang/boom/foo/bar/baz/bing/bang/boom/foo/bar/baz/bing/bang/boom/foo/bar/baz/bing/bang/boom/foo/bar/baz/bing/bang/boom/foo/bar/baz/bing/bang/boom'; - // tslint:enable: max-line-length - canCopy = false; + // eslint-disable-next-line max-len + public fakeUrl = 'https://github.com/foo/bar/baz/bing/bang/boom/foo/bar/baz/bing/bang/boom/foo/bar/baz/bing/bang/boom/foo/bar/baz/bing/bang/boom/foo/bar/baz/bing/bang/boom/foo/bar/baz/bing/bang/boom'; + public canCopy = true; + public format = 'standard'; + public theme: TsStyleThemeTypes = 'primary'; + public themes: TsStyleThemeTypes[] = ['primary', 'accent', 'warn']; } diff --git a/terminus-ui/copy/src/copy.component.html b/terminus-ui/copy/src/copy.component.html index 6174825d3..72caf1ceb 100644 --- a/terminus-ui/copy/src/copy.component.html +++ b/terminus-ui/copy/src/copy.component.html @@ -1,30 +1,32 @@
-
- -
- -
- - {{ icon }} - + + +
-
+ +
+ +
+ + {{ icon }} + +
+
+
diff --git a/terminus-ui/copy/src/copy.component.scss b/terminus-ui/copy/src/copy.component.scss index 0771d79ac..db0f790d5 100644 --- a/terminus-ui/copy/src/copy.component.scss +++ b/terminus-ui/copy/src/copy.component.scss @@ -2,11 +2,26 @@ @import './../../scss/helpers/cursors'; @import './../../scss/helpers/reset'; @import './../../scss/helpers/typography'; +@import './../../scss/helpers/scrollbars'; $margin__vertical: .2em; $margin__horizontal: $margin__vertical * 2; $radius: 3px; +/* + * TODO: We are manually adjusting the ripple in multiple places now. We should abstract this out. + * https://github.com/GetTerminus/terminus-ui/issues/1653 +*/ +$ripple-opacity: .4; +$black: color(pure, dark); +$primary: darken(color(primary), 10%); +$accent: darken(color(accent), 10%); +$warn: darken(color(warn), 10%); +$ripple-black: rgba($black, $ripple-opacity); +$ripple-primary: rgba($primary, $ripple-opacity); +$ripple-accent: rgba($accent, $ripple-opacity); +$ripple-warn: rgba($warn, $ripple-opacity); +$icon-padding: .25em .3em .25em .4em; // // @component @@ -21,13 +36,59 @@ $radius: 3px; // Top level styles should be nested here .c-copy { @include typography; + color: color(utility, dark); + position: relative; + } + + // + // Theme support + // + &--primary { + // These are the default styles + + .mat-ripple-element { + // NOTE: Important needed to override inline Material styles + // stylelint-disable-next-line declaration-no-important + background-color: $ripple-primary !important; + } + } + + &--accent { + .c-copy { + .c-copy__icon { + background-color: color(accent); + } + } + + .mat-ripple-element { + // NOTE: Important needed to override inline Material styles + // stylelint-disable-next-line declaration-no-important + background-color: $ripple-accent !important; + } + } + + &--warn { + .c-copy { + .c-copy__icon { + background-color: color(warn); + } + } + + .mat-ripple-element { + // NOTE: Important needed to override inline Material styles + // stylelint-disable-next-line declaration-no-important + background-color: $ripple-warn !important; + } + } + + // + // Format support + // + &--standard { background-color: color(utility, xlight); border: 1px solid color(utility, light); border-radius: $radius; - color: color(utility, dark); - padding: $margin__vertical $margin__horizontal; transition: border-color 200ms ease-in-out 50ms; - will-change: border-color; // Adding tabindex to the element allows focus, but we don't need the visual indicator &:focus { @@ -37,22 +98,43 @@ $radius: 3px; } } - // - // Theme support - // - &[theme='primary'] { - // These are the default styles + &--minimal { + .c-copy__content { + line-height: 24px; + padding: $icon-padding; + } + + .c-copy { + .c-copy__tooltip { + $offset-for-border-minimal: 3px; + bottom: $offset-for-border-minimal; + top: $offset-for-border-minimal; + } + } } - &[theme='accent'] { - .c-copy__icon { - background-color: color(accent); + &--icon { + display: inline-block; + + .c-copy__content { + // Match the width of the icon + width: 35px; + } + + .c-copy { + .c-copy__tooltip { + opacity: 1; + pointer-events: auto; + } } } - &[theme='warn'] { - .c-copy__icon { - background-color: color(warn); + &:focus, + &:hover { + .c-copy__tooltip { + opacity: 1; + pointer-events: auto; + transition-delay: 70ms; } } } @@ -60,35 +142,71 @@ $radius: 3px; .c-copy { //
Container for text content .c-copy__content { - // Match the line height of the copy icon - line-height: 24px; - overflow-x: scroll; + $icon-width: 35px; + @include hidden-scrollbars; + align-items: center; + justify-content: center; + line-height: 32px; + min-width: $icon-width; + overflow: hidden; white-space: nowrap; + + .ts-tooltip { + display: block; + max-width: 100%; + } + + .c-tooltip { + display: block; + overflow: hidden; + padding: $margin__vertical 0 $margin__vertical $margin__horizontal; + text-overflow: ellipsis; + } + } + + .c-copy__tooltip { + $offset-for-border-standard: -1px; + bottom: $offset-for-border-standard; + opacity: 0; + pointer-events: none; + position: absolute; + right: $offset-for-border-standard; + top: $offset-for-border-standard; + transition: opacity 200ms ease-out; + + .ts-tooltip { + height: 100%; + } + + .ts-icon { + align-items: center; + display: flex; + } } //
The container for the icon .c-copy__icon { $vertical-margin: calc(#{-$margin__vertical} - 1px); $horizontal-margin: calc(#{-$margin__horizontal} - 1px); - $icon-margin: $vertical-margin $horizontal-margin $vertical-margin 0; - $icon-padding: .25em .2em .2em .5em; @include cursor(pointer); background-color: color(primary); - border-radius: 0 $radius $radius 0; + border-radius: $radius; + bottom: 0; color: color(pure); - margin: $icon-margin; + height: 100%; padding: $icon-padding; - // Set up for mat-ripple - position: relative; transition: background-color 200ms ease-in; - // Double the width of the 24px icon - width: 38px; - will-change: background-color; } // Adjust icon alignment .mat-icon { vertical-align: bottom; } + + .ts-copy--standard & { + .c-copy__icon { + border-radius: 0 $radius $radius 0; + } + } } diff --git a/terminus-ui/copy/src/copy.component.spec.ts b/terminus-ui/copy/src/copy.component.spec.ts index bb1b3a200..7aafcf53f 100644 --- a/terminus-ui/copy/src/copy.component.spec.ts +++ b/terminus-ui/copy/src/copy.component.spec.ts @@ -4,6 +4,7 @@ import { } from '@terminus/ngx-tools/browser/testing'; import { ElementRefMock } from '@terminus/ngx-tools/testing'; import { noop } from '@terminus/ngx-tools/utilities'; +import { TsUILibraryError } from '@terminus/ui/utilities'; import { TsCopyComponent } from './copy.component'; @@ -20,36 +21,38 @@ describe(`TsCopyComponent`, function() { }); - it(`should exist`, () => { + test(`should exist`, () => { expect(component).toBeTruthy(); }); describe(`disableInitialSelection`, () => { + test(`should set and retrieve`, () => { component.disableInitialSelection = true; expect(component.disableInitialSelection).toEqual(true); }); + }); describe(`enableQuickCopy`, () => { + test(`should set and retrieve`, () => { component.enableQuickCopy = true; expect(component.enableQuickCopy).toEqual(true); }); + }); describe(`get textContent()`, () => { - it(`should return the content if accessible`, () => { + test(`should return the content if accessible`, () => { component.content.nativeElement.innerText = 'foo'; - expect(component.textContent).toEqual('foo'); }); - it(`should return an empty string if the content is not accessible`, () => { + test(`should return an empty string if the content is not accessible`, () => { component.content.nativeElement.innerText = null; - expect(component.textContent).toEqual(''); }); @@ -58,17 +61,17 @@ describe(`TsCopyComponent`, function() { describe(`selectText()`, () => { - it(`should return false if disabled`, () => { + test(`should return false if disabled`, () => { expect(component.selectText(component.content, false, true)).toEqual(false); }); - it(`should return if already selected`, () => { + test(`should return if already selected`, () => { expect(component.selectText(component.content, true, false)).toEqual(false); }); - it(`should select the text within the passed in element`, () => { + test(`should select the text within the passed in element`, () => { component['window'].getSelection = jest.fn().mockReturnValue({ removeAllRanges: noop, addRange: noop, @@ -87,7 +90,7 @@ describe(`TsCopyComponent`, function() { describe(`resetSelection()`, () => { - it(`should set the flag to false`, () => { + test(`should set the flag to false`, () => { component.hasSelected = true; expect(component.hasSelected).toEqual(true); @@ -117,7 +120,7 @@ describe(`TsCopyComponent`, function() { }); - it(`should set the text to the clipboard`, () => { + test(`should set the text to the clipboard`, () => { component['document'].body.appendChild = jest.fn(); component['document'].execCommand = jest.fn(); component.copyToClipboard('foo'); @@ -129,12 +132,11 @@ describe(`TsCopyComponent`, function() { }); - it(`should fall back to a prompt if execCommand fails`, () => { + test(`should fall back to a prompt if execCommand fails`, () => { component['document'].execCommand = () => { throw new Error('fake error'); }; component['window'].prompt = jest.fn(); - component.copyToClipboard('foo'); expect(component['window'].prompt).toHaveBeenCalled(); @@ -142,4 +144,24 @@ describe(`TsCopyComponent`, function() { }); + + describe(`format`, () => { + + test(`should set a default format and allow custom`, () => { + expect(component.format).toEqual('standard'); + component.format = 'minimal'; + expect(component.format).toEqual('minimal'); + }); + + + test(`should throw an error if consumer ues icon mode without quick copy enabled`, () => { + component.enableQuickCopy = false; + const actual = () => { + component.format = 'icon'; + }; + expect(actual).toThrowError(Error); + }); + + }); + }); diff --git a/terminus-ui/copy/src/copy.component.ts b/terminus-ui/copy/src/copy.component.ts index 83052c5eb..6c602f1c6 100644 --- a/terminus-ui/copy/src/copy.component.ts +++ b/terminus-ui/copy/src/copy.component.ts @@ -3,14 +3,28 @@ import { Component, ElementRef, Input, - ViewChild, + isDevMode, QueryList, + ViewChild, ViewChildren, ViewEncapsulation, } from '@angular/core'; import { TsDocumentService, TsWindowService, } from '@terminus/ngx-tools/browser'; -import { TsStyleThemeTypes } from '@terminus/ui/utilities'; +import { TsTooltipComponent } from '@terminus/ui/tooltip'; +import { + TsStyleThemeTypes, + TsUILibraryError, +} from '@terminus/ui/utilities'; + + + + +export type TsCopyDisplayFormat + = 'standard' + | 'minimal' + | 'icon' +; /** @@ -34,7 +48,15 @@ import { TsStyleThemeTypes } from '@terminus/ui/utilities'; selector: 'ts-copy', templateUrl: './copy.component.html', styleUrls: ['./copy.component.scss'], - host: {class: 'ts-copy'}, + host: { + 'class': 'ts-copy', + '[class.ts-copy--standard]': 'format === "standard"', + '[class.ts-copy--minimal]': 'format === "minimal"', + '[class.ts-copy--icon]': 'format === "icon"', + '[class.ts-copy--primary]': 'theme === "primary"', + '[class.ts-copy--accent]': 'theme === "accent"', + '[class.ts-copy--warn]': 'theme === "warn"', + }, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, exportAs: 'tsCopy', @@ -73,6 +95,12 @@ export class TsCopyComponent { @ViewChild('content', {static: true}) public content!: ElementRef; + /** + * Define access to all tooltip instances + */ + @ViewChildren(TsTooltipComponent) + public tooltipCollection!: QueryList; + /** * Define if the initial click should select the contents */ @@ -83,7 +111,29 @@ export class TsCopyComponent { * Define if the copy to clipboard functionality is enabled */ @Input() - public enableQuickCopy = false; + public enableQuickCopy = true; + + /** + * Define the UI style + */ + @Input() + public set format(value: TsCopyDisplayFormat) { + this._format = value ? value : 'standard'; + + if (this.format === 'icon' && !this.enableQuickCopy) { + this.enableQuickCopy = true; + + // istanbul ignore else + if (isDevMode()) { + throw new TsUILibraryError(`'enableQuickCopy' must be set to 'true' when using the icon only display mode`); + } + } + } + public get format(): TsCopyDisplayFormat { + return this._format; + } + private _format: TsCopyDisplayFormat = 'standard'; + /** * Define the component theme @@ -107,14 +157,8 @@ export class TsCopyComponent { * @return The text content of the inner */ public get textContent(): string { - const hasInnerText = - this.content && this.content.nativeElement && this.content.nativeElement.innerText; - - if (hasInnerText) { - return this.content.nativeElement.innerText; - } - return ''; - + const hasInnerText = this.content && this.content.nativeElement && this.content.nativeElement.innerText; + return hasInnerText ? this.content.nativeElement.innerText : ''; } diff --git a/terminus-ui/scss/helpers/_scrollbars.scss b/terminus-ui/scss/helpers/_scrollbars.scss index ca134311e..c0e0bcdca 100644 --- a/terminus-ui/scss/helpers/_scrollbars.scss +++ b/terminus-ui/scss/helpers/_scrollbars.scss @@ -40,3 +40,32 @@ $defaultColor: #{color(pure)}; background-color: $color; } } + + +@mixin hidden-scrollbars() { + &::-webkit-scrollbar { + -webkit-appearance: none; + + &:vertical { + width: 0; + } + + &:horizontal { + height: 0; + } + } + + &::-webkit-scrollbar-thumb { + background-color: transparent; + border-color: transparent; + } + + &::-webkit-scrollbar-track { + background-color: transparent; + border-color: transparent; + } + + &::-webkit-scrollbar-corner { + background-color: transparent; + } +} diff --git a/terminus-ui/tooltip/src/tooltip.component.scss b/terminus-ui/tooltip/src/tooltip.component.scss index 3287c91b4..4f828f088 100644 --- a/terminus-ui/tooltip/src/tooltip.component.scss +++ b/terminus-ui/tooltip/src/tooltip.component.scss @@ -29,5 +29,7 @@ @include elevation-element(snackbar); background-color: color(pure); color: color(pure, dark); + overflow-wrap: break-word; + white-space: normal; } } diff --git a/terminus-ui/utilities/src/error/ui-error.spec.ts b/terminus-ui/utilities/src/error/ui-error.spec.ts new file mode 100644 index 000000000..d732042bb --- /dev/null +++ b/terminus-ui/utilities/src/error/ui-error.spec.ts @@ -0,0 +1,18 @@ +import {TsUILibraryError} from './ui-error'; + + +describe(`TsUILibraryError`, () => { + let error: TsUILibraryError; + + beforeEach(() => { + error = new TsUILibraryError('Foo bar baz'); + }); + + test(`should return our error`, () => { + expect(error.name).toEqual('TsUILibraryError'); + expect(error.message).toEqual('Foo bar baz'); + expect(error.stack).toEqual(expect.stringContaining('Error: Foo bar baz')); + expect(error.stack).toEqual(expect.stringContaining('at new TsUILibraryError')); + }); + +}); diff --git a/terminus-ui/utilities/src/error/ui-error.ts b/terminus-ui/utilities/src/error/ui-error.ts new file mode 100644 index 000000000..44a178251 --- /dev/null +++ b/terminus-ui/utilities/src/error/ui-error.ts @@ -0,0 +1,11 @@ +/** + * A Terminus UI specific Error + */ +export class TsUILibraryError extends Error { + constructor(message: string) { + super(message); + this.message = message; + this.name = 'TsUILibraryError'; + this.stack = (new Error(message)).stack; + } +} diff --git a/terminus-ui/utilities/src/utilities.module.ts b/terminus-ui/utilities/src/utilities.module.ts index 2b296ec6c..ba2484221 100644 --- a/terminus-ui/utilities/src/utilities.module.ts +++ b/terminus-ui/utilities/src/utilities.module.ts @@ -3,6 +3,7 @@ import { NgModule } from '@angular/core'; import { TsReactiveFormBaseComponent } from './reactive-form-base/reactive-form-base.component'; export * from './cva-provider-factory/cva-provider-factory'; +export * from './error/ui-error'; export * from './input-has-changed/input-has-changed'; export * from './merge/merge'; export * from './reactive-form-base/reactive-form-base.component'; From b6177946139a7cb8084842a53706a5f49e19d821 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 28 Aug 2019 13:02:28 +0000 Subject: [PATCH 14/17] =?UTF-8?q?=F0=9F=93=9A=20Add=2014.9.0=20release=20n?= =?UTF-8?q?otes=20[skip=20ci]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d1761a07c..766408877 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [14.9.0](https://github.com/GetTerminus/terminus-ui/compare/v14.8.5...v14.9.0) (2019-08-28) + + +### Features + +* **Copy:** support for 'minimal' and 'icon' modes ([c835f5d](https://github.com/GetTerminus/terminus-ui/commit/c835f5d)), closes [#848](https://github.com/GetTerminus/terminus-ui/issues/848) + ## [14.8.5](https://github.com/GetTerminus/terminus-ui/compare/v14.8.4...v14.8.5) (2019-08-26) From 5ff0e95ec5dbbf97531eed18ee4d4f7d11edf8fd Mon Sep 17 00:00:00 2001 From: Benjamin Charity Date: Wed, 28 Aug 2019 08:40:31 -0400 Subject: [PATCH 15/17] revert(CI): remove workflow waiting until v2 becomes more stable --- .github/workflows/label-approved-prs.yml | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 .github/workflows/label-approved-prs.yml diff --git a/.github/workflows/label-approved-prs.yml b/.github/workflows/label-approved-prs.yml deleted file mode 100644 index 81755532f..000000000 --- a/.github/workflows/label-approved-prs.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: "Label Approved PRs" -on: [pull_request_review] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Label approved pull requests - uses: pullreminders/label-when-approved-action@v1.0.3 - env: - APPROVALS: ${{ 1 }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - LABEL_NAME: ${{ 'Status: ready to merge' }} From 3681da89cc8b726b79870592e993c74cbfccb88e Mon Sep 17 00:00:00 2001 From: Benjamin Charity Date: Mon, 26 Aug 2019 08:21:50 -0400 Subject: [PATCH 16/17] fix(Tooltip): add testing packgage.json Also added 1 missing import ISSUES CLOSED: #1638 --- terminus-ui/tooltip/testing/package.json | 7 +++++++ terminus-ui/tooltip/testing/src/test-components.ts | 1 + terminus-ui/tsconfig.spec.json | 1 + 3 files changed, 9 insertions(+) create mode 100644 terminus-ui/tooltip/testing/package.json diff --git a/terminus-ui/tooltip/testing/package.json b/terminus-ui/tooltip/testing/package.json new file mode 100644 index 000000000..39d9583f0 --- /dev/null +++ b/terminus-ui/tooltip/testing/package.json @@ -0,0 +1,7 @@ +{ + "ngPackage": { + "lib": { + "entryFile": "src/public-api.ts" + } + } +} diff --git a/terminus-ui/tooltip/testing/src/test-components.ts b/terminus-ui/tooltip/testing/src/test-components.ts index 975cd1cc3..18fbd31c3 100644 --- a/terminus-ui/tooltip/testing/src/test-components.ts +++ b/terminus-ui/tooltip/testing/src/test-components.ts @@ -7,6 +7,7 @@ import { import { TsTooltipComponent, TsTooltipModule, + TsTooltipPositionTypes, } from '@terminus/ui/tooltip'; diff --git a/terminus-ui/tsconfig.spec.json b/terminus-ui/tsconfig.spec.json index 37b31fe95..d8254edd4 100644 --- a/terminus-ui/tsconfig.spec.json +++ b/terminus-ui/tsconfig.spec.json @@ -45,6 +45,7 @@ "@terminus/ui/table" : ["terminus-ui/table/src/public-api.ts"], "@terminus/ui/toggle" : ["terminus-ui/toggle/src/public-api.ts"], "@terminus/ui/tooltip" : ["terminus-ui/tooltip/src/public-api.ts"], + "@terminus/ui/tooltip/testing" : ["terminus-ui/tooltip/testing/src/public-api.ts"], "@terminus/ui/utilities" : ["terminus-ui/utilities/src/public-api.ts"], "@terminus/ui/validation-messages" : ["terminus-ui/validation-messages/src/public-api.ts"], "@terminus/ui/validators" : ["terminus-ui/validators/src/public-api.ts"] From d2828e2eabd758a50e364accb6c869c22d8859a3 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 28 Aug 2019 13:37:46 +0000 Subject: [PATCH 17/17] =?UTF-8?q?=F0=9F=93=9A=20Add=2014.9.1=20release=20n?= =?UTF-8?q?otes=20[skip=20ci]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 766408877..71e9c5bbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +## [14.9.1](https://github.com/GetTerminus/terminus-ui/compare/v14.9.0...v14.9.1) (2019-08-28) + + +### Bug Fixes + +* **Tooltip:** add testing packgage.json ([3681da8](https://github.com/GetTerminus/terminus-ui/commit/3681da8)), closes [#1638](https://github.com/GetTerminus/terminus-ui/issues/1638) + + +### Reverts + +* **CI:** remove workflow ([5ff0e95](https://github.com/GetTerminus/terminus-ui/commit/5ff0e95)) + # [14.9.0](https://github.com/GetTerminus/terminus-ui/compare/v14.8.5...v14.9.0) (2019-08-28)