Comments (18)
@driskull This sounds like it would add a regression bug. Currently, the desired behavior the entire tip manager doesn't have a single title, but that the tips within the manager can be "grouped" by sharing a common title for some, and a common title for others. This was a feature requested by @asangma.
See Bullet 2
I'm open to improvements to the implementation details - but we'll need a solution that maintains the current functionality.
from calcite-app-components.
This is not a regression, it is changing from a data-attribute to a custom element attribute.
from calcite-app-components.
Proposed change
- Create a
calcite-tip-group
component - This avoids declaring the group title multiple times.
<calcite-tip-manager>
<calcite-tip-group text-title="My Group">
<calcite-tip></calcite-tip>
<calcite-tip></calcite-tip>
<calcite-tip-group>
</calcite-tip-manager>
Which would follow practices of native elements like select
<select>
<optgroup label="Swedish Cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
</optgroup>
<optgroup label="German Cars">
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</optgroup>
</select>
from calcite-app-components.
Ok at first I thought you wanted to elevate it to the manager. We're keeping it on the tip, just changing the name and adding a prop.
from calcite-app-components.
I think we should make a decision on using a group vs declaring it on multiple tips because this will affect other widgets and how they are architected.
from calcite-app-components.
👍 Let's discuss in our sync in a few.
from calcite-app-components.
Another reason why the group title doesn't belong on the tip is because the tip doesn't render it. Its only rendered on the TipManager. So it makes more sense on a group element that can be tied to the TipManager and would only work with the TipManager.
from calcite-app-components.
By that logic, wouldn't that also preclude it from belonging on the groupElement? The group element doesn't render the title either.
from calcite-app-components.
Generally in my experience, avoiding unneccessary DOM structure saves hassle.
Here's an example of where adding wrapping elements can monkey with flexbox.
https://codepen.io/pr3tori4n/pen/xoeaBr
Extra DOM Also affects direct child selectors and sibling selectors in CSS.
Additionally it would affect inline or inline-block layout behavior. If the child elements were inline-block, the wrapper would have to be also.
It would also impact the mutation observer, requiring us to listen to changes in the subtree.
from calcite-app-components.
By that logic, wouldn't that also preclude it from belonging on the groupElement? The group element doesn't render the title either.
Nope, because we could document the group
element as an optional part of creating a TipManager.
The TipManager would render tips
or a group of tips
.
avoiding unneccessary DOM structure saves hassle.
I wouldn't say its unnecessary. Its semantically necessary.
Extra DOM Also affects direct child selectors and sibling selectors in CSS.
Additionally it would affect inline or inline-block layout behavior. If the child elements were inline-block, the wrapper would have to be also.
I don't see how this is an issue in this use case. Is this relevant to this change?
It would also impact the mutation observer, requiring us to listen to changes in the subtree.
Yeah, it adds some extra logic but I think its worth it.
from calcite-app-components.
If this isn't going to make it into V1 lets...
- Remove the data attribute
- Do not document any way to set the group title and it will only ever show "Tips" for V1.
V2...
- Introduce
<calcite-tip-group text-title="My Group">
from calcite-app-components.
@jcfranco did you sync with Matt last week regarding this? Currently there's a wrinkle - the tip manager CSS is modifying the tips border and box shadow, as well as controlling the hiding/showing of the selected tip. This CSS no longer works if we add a wrapping component, since the ::slotted() selector is only able to target elements 1 level inside a slot.
A possible solution would be to use the hidden attribute instead of "selected" to control hide/show. But what should be done about the tip's normal boundary? We could add a prop to tip which toggles this, but should that be added by the tip manager, or should that be something expected of whoever is implementing this?
from calcite-app-components.
A possible solution would be to use the hidden attribute instead of "selected" to control hide/show. But what should be done about the tip's normal boundary? We could add a prop to tip which toggles this, but should that be added by the tip manager, or should that be something expected of whoever is implementing this?
Would hidden
and selected
handle both of the issues?
hidden
would hide the ones that don't need to be shown and selected
could handle the styling differences.
Currently, the TipManager is setting selected
on the Tip but that is not actually a valid documented property.
from calcite-app-components.
Would hidden and selected handle both of the issues?
No. The tip manager has these lines of CSS. Currently adding selected
handles both cases. If we introduce a new wrapping component (e.g. ) as suggested, there's no CSS we can add to the tip manager that can affect the tips. In essence, the tip manager would lose any stylistic control it currently has over tips.
This problem is avoided if we continue to rely on an attribute for grouping tips. It's worth calling out this is how radio buttons and checkboxes work as a contrasting example to a select, relying on a common name
attribute.
If we proceed with the new custom element as a solution to grouping, we could get around this if we move the CSS that's currently in the tip manager styles to the tip styles. Hide/show already exists for [hidden]
. We'd need some other style modifier and a new prop to activate it to create a modified tip style. As an example:
@Prop() noBoundary = false;
:host[noBoundary] {
box-shadow: none;
max-width: $tip-max-width;
width: $tip-width;
margin: 0;
padding: 0;
}
What's your preference?
from calcite-app-components.
In essence, the tip manager would lose any stylistic control it currently has over tips.
I think that is ok. If you add a @Prop selected
to the Tip
, you can use it to style the Tip within the Tip's CSS instead of from the TipManager. (I think this is better)
Currently, you are adding a selected
attribute on the Tip, but that is not a valid documented property.
we could get around this if we move the CSS that's currently in the tip manager styles to the tip styles.
Yep!
@prop() noBoundary = false;
Can't you just use selected
???? If you're using a stand-alone Tip, then you don't need to set selected
and it would not get the styles.
from calcite-app-components.
This problem is avoided if we continue to rely on an attribute for grouping tips. It's worth calling out this is how radio buttons and checkboxes work as a contrasting example to a select, relying on a common name attribute.
That is comparing apples and oranges. The name
attribute is for referencing, not grouping or sharing a common text value.
Its actually more like a FieldSet/Legend...
<fieldset name="test">
<legend>Personalia:</legend>
Name: <input type="text"><br>
Email: <input type="text"><br>
Date of birth: <input type="text">
</fieldset>
from calcite-app-components.
@pr3tori4n Do you think the selected
approach would work? I'd suggest proceeding with this work, not doc group title to move forward with v1-alpha.0
. IMO, we can squeeze this in if not disruptive in an alpha update.
from calcite-app-components.
This has been merged. @driskull please verify.
from calcite-app-components.
Related Issues (20)
- Enhancement: Support dragging items between Calcite Value Lists HOT 3
- Enhancement: Reusable border style HOT 1
- Tooling: Add changelog for prerelease/next updates HOT 1
- Bug: Action icon scale should be medium unless Action scale is L HOT 3
- Bug: action-bar does not synchronize expanded state with new children HOT 2
- calcite-value-list: calciteListItemChange event HOT 4
- Bug: calcite-pick-list group items remain when filtering HOT 6
- Bug: calcite-block-section toggle button spacing HOT 2
- Tooling: ensure changelog contains changes from prereleases HOT 2
- Bug: calcite-shell-center-row, if no actionBar specified get an error HOT 1
- Enhancement: ActionBar & ActionPad. Add scale property that its Actions inherit. HOT 1
- Bug: Action. Icon size update. HOT 1
- Bug: calcite-block-section calciteBlockSectionToggle is not fired anymore HOT 3
- Bug: calcite-pick-list-item is always using the circleF icon even when not selected HOT 3
- slot-container height of 0 HOT 4
- [calcite-app-components] migration plan HOT 1
- Enhancement: Ability to drag and drop items between different lists HOT 3
- Enhancement: Ability to set orientation (vertical/horizontal) on calcite-action-bar HOT 1
- Bug: calcite-block-section and intlExpand/intlCollapse HOT 1
- Enhancement: Make Calcite-Value-List-Item fully draggable HOT 1
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 calcite-app-components.