-
Notifications
You must be signed in to change notification settings - Fork 106
feat(label-group): create pf-label-group element #2949
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
Open
saraDahanCode
wants to merge
28
commits into
patternfly:main
Choose a base branch
from
saraDahanCode:create-pf-lable-group
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 12 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
d86e8ac
feat(label-group): add new label-group-element
7f82f28
chore(label-group): minor updates
9b251d6
feat(label-group): add new functions and features for label management
8514436
chore: add changeset for pf-label-group element
8e3236a
docs(label-group): add demos for closeable,overflow,vertical,header o…
751df4c
fix: correct config path
5528dd3
chore: small fixes after review
72c0833
chore: push current state for debugging build errors
64688ae
chore(label-group): resolve merge conflicts and update package-lock.json
616b18d
chore(label-group): fix errors
12c0d2a
chore(label-group): resolve patch conflict keeping upstream version
bc5f6c9
chore(label-group): resolve patch conflict keeping upstream version
5c721a7
docs(label-group): update changeset to follow changelog format
e211096
chore(label-group): fix whitespace and formatting in demos
89c762f
Revert changes to package-lock.json per PR review
16212ee
fix(label-group): make collapsedText placeholder generic
141781e
fix(label-group): wrap #labels getter with server check to avoid DOM …
9f82c0b
fix(label-group): wrap #labels getter with server check to avoid DOM …
fb079ed
fix(label-group): guard DOM access for SSR
06ada58
docs: update README with latest instructions
7348fd0
chore(label-group): update pf-label-group.ts
37a1cb6
feat(label-group): add Functionality
0dcec75
chore(label-group): apply the reqeasted changes
2eeae64
feat(label-group): add demo to add label
Michal7290 626f9f2
Merge remote-tracking branch 'sara/create-pf-lable-group' into create…
Michal7290 8cfa3ef
feat(label-group): change the demos
Michal7290 b00fa46
Merge pull request #1 from Michal7290/create-pf-lable-group
saraDahanCode cffdff2
chore(label-group): transferring the insertion logic from TS to Demos
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| "@patternfly/elements": minor | ||
| --- | ||
|
|
||
| Introduce `<pf-label-group>` element with: | ||
| - Removable labels and option to remove entire group | ||
| - Overflow handling for labels and title | ||
| - Horizontal and vertical layout support | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
saraDahanCode marked this conversation as resolved.
Show resolved
Hide resolved
bennypowers marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Label Group | ||
| # <pf-label-group> | ||
|
|
||
| A **label group** is a collection of labels that can be grouped by category and used to represent one or more values assigned to a single attribute. | ||
| When the number of labels exceeds `numLabels`, additional labels are hidden under an overflow label. | ||
|
|
||
| --- | ||
| ## Usage | ||
|
|
||
| ```html | ||
| <pf-label-group num-labels="2"> | ||
| <span slot="category">Fruit Types</span> | ||
| <pf-label>Apple</pf-label> | ||
| <pf-label>Banana</pf-label> | ||
| <pf-label>Orange</pf-label> | ||
| </pf-label-group> | ||
| ``` | ||
|
|
||
| Displays a group of labels, showing only the first two and an overflow label like “1 more” that expands on click. | ||
|
|
||
| --- | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <pf-label-group closeable> | ||
| <h2 slot="category">group name</h2> | ||
| <pf-label color="red" icon="info-circle" removable>label-1</pf-label> | ||
| <pf-label color="green" icon="info-circle" removable>label-2</pf-label> | ||
| <pf-label color="blue" icon="info-circle" removable>label-3</pf-label> | ||
| </pf-label-group> | ||
|
|
||
| <script type="module"> | ||
| import '@patternfly/elements/pf-label-group/pf-label-group.js'; | ||
| import '@patternfly/elements/pf-label/pf-label.js'; | ||
| import '@patternfly/elements/pf-button/pf-button.js'; | ||
| </script> |
13 changes: 13 additions & 0 deletions
13
elements/pf-label-group/demo/label-group-with-a-very-long-name.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
|
|
||
| <pf-label-group > | ||
saraDahanCode marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <h2 slot="category">label group with a very long name</h2> | ||
| <pf-label color="yellow" icon="info-circle" removable>label-1</pf-label> | ||
| <pf-label color="red" icon="info-circle" removable>label-2</pf-label> | ||
| <pf-label color="blue" icon="info-circle" removable>label-3</pf-label> | ||
| </pf-label-group> | ||
|
|
||
| <script type="module"> | ||
| import '@patternfly/elements/pf-label-group/pf-label-group.js'; | ||
| import '@patternfly/elements/pf-label/pf-label.js'; | ||
| import '@patternfly/elements/pf-button/pf-button.js'; | ||
| </script> | ||
17 changes: 17 additions & 0 deletions
17
elements/pf-label-group/demo/label-group-with-overflow-labels.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
|
|
||
| <pf-label-group closeable num-labels="3" > | ||
| <h2 slot="category">group name</h2> | ||
|
|
||
| <pf-label color="orange" icon="info-circle" removable>label-1</pf-label> | ||
| <pf-label color="purple" icon="info-circle" removable>label-2</pf-label> | ||
| <pf-label color="blue" icon="info-circle" removable>label-3</pf-label> | ||
| <pf-label color="red" icon="info-circle" removable>label-4</pf-label> | ||
| <pf-label color="blue" icon="info-circle" removable>label-5</pf-label> | ||
| <pf-label color="green" icon="info-circle" removable>label-6</pf-label> | ||
| </pf-label-group> | ||
|
|
||
| <script type="module"> | ||
| import '@patternfly/elements/pf-label-group/pf-label-group.js'; | ||
| import '@patternfly/elements/pf-label/pf-label.js'; | ||
| import '@patternfly/elements/pf-button/pf-button.js'; | ||
| </script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <pf-label-group open num-labels="5"> | ||
| <pf-label color="blue">Blue Label</pf-label> | ||
| <pf-label color="green">Green Label</pf-label> | ||
| <pf-label color="orange">Orange Label</pf-label> | ||
| <pf-label color="red">Red Label</pf-label> | ||
|
|
||
| </pf-label-group> | ||
|
|
||
| <script type="module"> | ||
| import '@patternfly/elements/pf-label-group/pf-label-group.js'; | ||
| import '@patternfly/elements/pf-label/pf-label.js'; | ||
| import '@patternfly/elements/pf-button/pf-button.js'; | ||
| </script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| {% renderOverview %} | ||
| <pf-label-group></pf-label-group> | ||
| {% endrenderOverview %} | ||
|
|
||
| {% band header="Usage" %}{% endband %} | ||
|
|
||
| {% renderSlots %}{% endrenderSlots %} | ||
|
|
||
| {% renderAttributes %}{% endrenderAttributes %} | ||
|
|
||
| {% renderMethods %}{% endrenderMethods %} | ||
|
|
||
| {% renderEvents %}{% endrenderEvents %} | ||
|
|
||
| {% renderCssCustomProperties %}{% endrenderCssCustomProperties %} | ||
|
|
||
| {% renderCssParts %}{% endrenderCssParts %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
|
|
||
saraDahanCode marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| :host { | ||
| display: flex; | ||
| flex-direction: row; | ||
| position: relative; | ||
| gap: 0.5rem; | ||
| border: 0; | ||
| } | ||
|
|
||
| pf-button { | ||
| --pf-c-button--FontSize: var(--pf-c-label__c-button--FontSize, var(--pf-global--FontSize--xs, 0.75rem)); | ||
| --pf-c-button--PaddingTop: var(--pf-c-label__c-button--PaddingTop, var(--pf-global--spacer--xs, 0.25rem)); | ||
| --pf-c-button--PaddingRight: var(--pf-c-label__c-button--PaddingRight, var(--pf-global--spacer--sm, 0.5rem)); | ||
| --pf-c-button--PaddingBottom: var(--pf-c-label__c-button--PaddingBottom, var(--pf-global--spacer--xs, 0.25rem)); | ||
| --pf-c-button--PaddingLeft: var(--pf-c-label__c-button--PaddingLeft, var(--pf-global--spacer--sm, 0.5rem)); | ||
| margin: var(--pf-c-label__c-button--MarginTop, -0.5rem) | ||
| var(--pf-c-label__c-button--MarginRight, -0.5rem) | ||
| var(--pf-c-label__c-button--MarginBottom, -0.5rem) | ||
| var(--pf-c-label__c-button--MarginLeft, 0.25rem); | ||
| } | ||
|
|
||
| .compact { | ||
| --pf-c-label--PaddingTop: var(--pf-c-label--m-compact--PaddingTop, 0); | ||
| --pf-c-label--PaddingRight: var(--pf-c-label--m-compact--PaddingRight, var(--pf-global--spacer--sm, 0.5rem)); | ||
| --pf-c-label--PaddingBottom: var(--pf-c-label--m-compact--PaddingBottom, 0); | ||
| --pf-c-label--PaddingLeft: var(--pf-c-label--m-compact--PaddingLeft, var(--pf-global--spacer--sm, 0.5rem)); | ||
| --pf-global--icon--FontSize--sm: 12px; | ||
| } | ||
|
|
||
| .add-label-btn { | ||
| background-color: #fff; | ||
| color: #0066cc; | ||
| border: 1px solid #d2d2d2; | ||
| border-radius: 9999px; | ||
| padding: 0px 2px; | ||
| font-size: 9px; | ||
| cursor: pointer; | ||
| font-weight: 500; | ||
| } | ||
|
|
||
| .add-label-btn:hover { | ||
| background-color: #f5f5f5; | ||
| } | ||
|
|
||
| #outer { | ||
| display: flex; | ||
| flex-wrap: wrap; | ||
| gap: 0.25rem; | ||
| padding: 0.5rem; | ||
| border: 1px solid #d2d2d2; | ||
| border-radius: 6px; | ||
| background-color: #fff; | ||
|
|
||
| align-items: center; | ||
| } | ||
|
|
||
|
|
||
| :host([orientation="horizontal"]) #outer { | ||
| flex-direction: row; | ||
| } | ||
|
|
||
| :host([orientation="vertical"]) #outer { | ||
| flex-direction: column; | ||
| align-items: flex-start; | ||
| } | ||
|
|
||
| ::slotted([slot="category"]) { | ||
| display: inline-block; | ||
| max-width: 16ch; | ||
| overflow: hidden; | ||
| text-overflow: ellipsis; | ||
| white-space: nowrap; | ||
| vertical-align: middle; | ||
| cursor: default; | ||
| } | ||
|
|
||
| ::slotted([slot="category"][title]):hover { | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.