feat(label-group): create pf-label-group element#2949
feat(label-group): create pf-label-group element#2949saraDahanCode wants to merge 30 commits intopatternfly:mainfrom
Conversation
🦋 Changeset detectedLatest commit: 2d9e0e8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…verflow, and basic label groups
|
@bennypowers When running the dev server, three TypeScript type errors occur in tools/pfe-tools/dev-server/config.ts: cors, cacheBusterMiddleware, liveReloadTsChangesMiddleware middlewares fail due to incompatible Koa types. The errors indicate Property 'back' is missing and type conflicts between different @types/koa versions. This prevents the dev server from starting and causes the tests to fail. Example snippet: 127 cors, // TS2322: Type '(ctx: Context, next: Next) => Promise' is not assignable to type 'Middleware' It seems related to multiple @types/koa versions being used in the project. |
|
@markcaron @bennypowers @zeroedin Hi, |
420bb96 to
bc5f6c9
Compare
elements/pf-label-group/demo/label-group-with-a-very-long-name.html
Outdated
Show resolved
Hide resolved
✅ Deploy Preview for patternfly-elements ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
feat(label-group): change demo
| if (filledYes) filledYes.checked = true; | ||
| } | ||
|
|
||
| function openModal() { |
There was a problem hiding this comment.
it's not clear what this function is doing.
add a trigger button for the modal, and use modal events to handle close, as in line 128
There was a problem hiding this comment.
@bennypowers
so I’ll remove the openModel function, use the other inner functions when needed, and put the model in HTML. right?
There was a problem hiding this comment.
like this:
<pf-button id="modal-toggle">Show Modal</pf-button>
<pf-modal>
<h2 slot="header">Add label</h2>
<form id="add-label-form">
<label>
Label text:
<input id="label-text" class="pf-c-form-control" />
</label>
<label>
Color:
<pf-select id="color-select" class="pf-c-form-control">
<pf-option value="Grey" selected>Grey</pf-option>
<pf-option value="Blue">Blue</pf-option>
<pf-option value="Cyan">Cyan</pf-option>
<pf-option value="Green">Green</pf-option>
<pf-option value="Orange">Orange</pf-option>
<pf-option value="Purple">Purple</pf-option>
<pf-option value="Red">Red</pf-option>
<pf-option value="Gold">Gold</pf-option>
</pf-select>
</label>
<label>
Icon:
<pf-select id="icon-select" class="pf-c-form-control">
<pf-option value=""><span>No Icon</span></pf-option>
<pf-option value="info-circle"><pf-icon name="info-circle"></pf-icon>Info</pf-option>
<pf-option value="check-circle"><pf-icon name="check-circle"></pf-icon>Check</pf-option>
<pf-option value="exclamation-circle"><pf-icon name="exclamation-circle"></pf-icon>Warning</pf-option>
</pf-select>
</label>
<div class="radio-group">
<label>Dismissable:</label>
<div>
<label><input type="radio" name="dismissable" value="true"> Yes</label>
<label><input type="radio" name="dismissable" value="false" checked> No</label>
</div>
</div>
<div class="radio-group">
<label>Label type:</label>
<div>
<label><input type="radio" name="filled" value="true" checked> Filled</label>
<label><input type="radio" name="filled" value="false"> Outlined</label>
</div>
</div>
</form>
<pf-button id="modal-add" slot="footer" variant="primary">Save</pf-button>
<pf-button id="modal-cancel" slot="footer" variant="secondary">Cancel</pf-button>
</pf-modal>keep this single modal in HTML, don't create a new one every time there's a call ("modal" is an adjective, meaning that when the modal dialog is displayed, no other actions can occur until the dialog is dismissed or completed)
There was a problem hiding this comment.
got it. I'll implement it.
| console.log('modal is created'); | ||
|
|
||
| modal.innerHTML = ` | ||
| <h2 slot="header">Add label</h2> |
There was a problem hiding this comment.
This modal content is static, so put it in the HTML rather than in javascript, and call showModal() on it when you need to
Partially addresses #2935
What I did
<pf-label-group>element.<pf-label>elements with support for removable and overflow states.overflowbehavior that collapses extra labels into a "+N more" indicator.LabelGroupCloseEventwhen the whole group is closed./demo/pf-label-group/showing various configurations (horizontal, vertical, removable, overflow, and closable examples)..changesetfile with typeminorto trigger a release.Testing Instructions
npm startand openhttp://localhost:8000/elements/pf-label-group/demo/.LabelCloseEventis fired.npm run lintandnpm testto ensure all checks pass successfully.Notes to Reviewers
.changesetfile is set to minor, since this PR introduces a new element.