-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add lock icon for disabled and readonly states #189
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
72f6196
Fix: Adjust iconography in examples
ynotdraw 8fab184
Add lock icon component
ynotdraw a4b0e66
Add lock to input-field
ynotdraw bb1608b
Add lock to textarea-field
ynotdraw 4bbbf29
Add lock to checkbox-group-field
ynotdraw 5aaf972
Fix: Adjust iconography in examples
ynotdraw ec03888
Add lock to radio-group-field
ynotdraw aa43555
Add lock to checkbox-field
ynotdraw d50b071
Add tests
ynotdraw 718dd1d
Add lock icon to file-input-field
ynotdraw eec247d
Add lock icon for read-only states too
ynotdraw d6b8be9
Update lock-icon Element type
ynotdraw 50547ad
Added a changeset
ynotdraw f9a52a6
Adjust negative margin-top
ynotdraw d7627b2
Renamed "isInAGroup" to "isGrouped"
ynotdraw 0a70f14
Adjust lock icon + spacing
ynotdraw bef5d3d
Set lock-icon blocks to never
ynotdraw 4e80e9e
Revert "Set lock-icon blocks to never"
ynotdraw 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 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,6 @@ | ||
--- | ||
'@crowdstrike/ember-toucan-core': patch | ||
'@crowdstrike/ember-toucan-form': patch | ||
--- | ||
|
||
Add a lock icon to readonly and disabled states for all form components. |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
19 changes: 19 additions & 0 deletions
19
packages/ember-toucan-core/src/-private/components/lock-icon.hbs
This file contains 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,19 @@ | ||
<svg | ||
width="12" | ||
height="12" | ||
viewBox="0 0 12 12" | ||
fill="currentColor" | ||
aria-hidden="true" | ||
class="text-disabled" | ||
data-lock-icon | ||
...attributes | ||
> | ||
<g> | ||
<path d="M5.5 6v3h1V6h-1Z" /> | ||
<path | ||
fill-rule="evenodd" | ||
clip-rule="evenodd" | ||
d="M3 3.5V3a3 3 0 0 1 6 0v.5h.5A1.5 1.5 0 0 1 11 5v5a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 1 10V5a1.5 1.5 0 0 1 1.5-1.5H3ZM4 3a2 2 0 1 1 4 0v.5H4V3ZM2 5a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 .5.5v5a.5.5 0 0 1-.5.5h-7A.5.5 0 0 1 2 10V5Z" | ||
/> | ||
</g> | ||
</svg> |
11 changes: 11 additions & 0 deletions
11
packages/ember-toucan-core/src/-private/components/lock-icon.ts
This file contains 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,11 @@ | ||
import templateOnlyComponent from '@ember/component/template-only'; | ||
|
||
export interface ToucanLockIconComponentSignature { | ||
Element: SVGElement; | ||
Args: {}; | ||
Blocks: { | ||
default: []; | ||
}; | ||
} | ||
|
||
export default templateOnlyComponent<ToucanLockIconComponentSignature>(); |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No way to get the type system to fail to check if the consumer passes a block, eh?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could be missing something somewhere, but I tried
Blocks: never
andglint
still passedThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Womp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it has to be
Blocks: { default: never }
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! you were right! TIL! Thanks a bunch, @nicolechung !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm getting this with
Blocks: { default: never }
:The error seems to be coming from our use of
never
rather than the fact that the consumer is passing a default block. I think the error we'd want to see would read something like "Argument of type [...] is not assignable to parameter of type 'never'".What's less bad? Not producing a typechecking error when we should be or producing a wrong and possibly confusing error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Talked over Zoom - we reverted!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the RFC it says if you have no blocks then it might work, but I'm not sure if this has been implemented.
https://rfcs.emberjs.com/id/0748-glimmer-component-signature/#blocks