Comments (4)
Hard one to start with, due to dialog considerations :) I like the directive approach to dialog-title, description etc. I'd honestly take it further and make the entire thing a structural directive as this would allow us to pass context to the entire component & extend it, remove the internal button from it's content projection & make the current *dialogContent directive unnecessary.
Single component example:
<button [brnDialogTriggerFor]="myAlert" />
<div #myAlert *brnDialog="data; let ctx=context;" />
<!-- dialog content -->
</div>
This would also allow for a constructor based approach a la angular cdk
@Component({
// dialog
})
class DialogComponent {
private readonly ctx = inject(BrnDialogContext);
}
@Component({
template: `
<button (click)="openDialog()" />Open</button>
`
})
class ParentComponent {
private readonly dialog = inject(BrnDialog);
openDialog() {
this.dialog.open(DialogComponent, {
// options,
data
})
}
}
We could separate data & the dialog ref into separate injection tokens/passed context props or have them on the same object as I think most use both when using injection
interface BrnDialogRef<Output = unknown> {
close(output?: Output): void;
afterClosed(): Observable<Output | undefined>
// other relevant fns
}
type BrnDialogContext<Input = unknown, Output = unknown> {
readonly $implicit: Input;
readonly ref: BrnDialogRef<Output>;
readonly data: Input // getter to $implicit for easier typing within .ts files
}
Then the alert can either be done as a simple alert component, composed with the dialog component itself or as syntax sugar for the dialog directive through extension. Functionally it would do the same.
I'm a bit unsure on the separation of Cancel & Action buttons, maybe an angular material like approach with a simple [brn-dialog-close]="outputData"
would suffice?
The overlay i don't mind either way, since tw would allow for any reasonable customization through background color, opacity.. class props
from spartan.
We could do that too for sure. Using the wrapper component could allow people to add classes to that component which are used to style the backdrop, and "hides" the manual wiring up of the trigger by using a reference to the directive exposed by "exportAs". I think that would make it more beginner friendly, but they're also not mutually exclusive.
If you have a wrapper it does the wiring up for you if you don't you'll need to do it yourself?
from spartan.
Yeah I just looked at the radix UI code to see if any special aria roles are assigned by those close and action buttons and it does not seem so. I think it could be a convenience thing to add the directives, but with exposing the context it's absolutely not needed. Very open to drop them tbh
from spartan.
Fair :) a wrapper it is.
Not really firm on this one either, personally id always use close, but we can always add more descriptive selectors to that directive
from spartan.
Related Issues (20)
- Include authentication UI example at examples page HOT 2
- Docs mention @ngneat/cmdk instead of @ngxpert/cmdk HOT 1
- RFC: Advanced pagination
- RFC: Radio Groups as card layouts HOT 6
- Docs: API reference for all components
- Renaming the generated `hlm-` selector to anything else breaks the `select` component HOT 10
- Popover overflowing past screen when trigger is on the edge of the screen HOT 3
- Add the multi select component
- Peer dependencies causing problem - multiple versions of ui-core HOT 3
- ERROR RuntimeError: NG0203: inject() must be called from an injection context such as a constructor
- ERROR ReferenceError: window is not defined HOT 1
- [nitro] [request error] [unhandled] [GET] "/trpc/note.list,note.list
- Error: Error: Cannot find module tslib ... code: 'ERR_MODULE_NOT_FOUND'
- (node:77788) [DEP0155] DeprecationWarning: Use of deprecated trailing slash pattern
- Dropdown does not lock page scroll HOT 6
- Select: Initial Value is not set when options are provided vie @for
- Adding the hlmMenuItem directive on dropdown separated in multiple components throw an exception HOT 1
- unable to install nx-workspace with presets HOT 1
- hlmSelect does not have an invalid state style HOT 9
- Module Not recognize HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spartan.