-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Environment locks #26
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
akazemier-godaddy
wants to merge
26
commits into
main
Choose a base branch
from
environment-locks
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 9 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
9a1de8f
major: env locking
3rd-Eden ed3a184
doc: improve docs
3rd-Eden d1dff30
fix: update packages with removal of internal props
3rd-Eden c95d854
fix: use env and use-props as part of tests
3rd-Eden 18135e6
fix: corrected assertion now that we properly merge slots
3rd-Eden 2221d3d
fix: clean up references and dead branches
3rd-Eden 1431ebb
test: clean up tests
3rd-Eden ed49047
major: effectively breaking how data-override worked before
3rd-Eden 8981a44
fix: 90%, im sad about it
3rd-Eden 8757552
lint: linting
3rd-Eden 85a0f6b
Merge branch 'main' into environment-locks
akazemier-godaddy 3d8c25e
chore: merge origin/main into environment-locks
3rd-Eden 03cf185
fix: it should only trigger on locked
3rd-Eden 886759c
fix: update env
3rd-Eden 2f43a67
fix: data-override should be disabled by default
3rd-Eden c874953
fix: update tests as data-override is no longer triggering by default
3rd-Eden fbce5ce
Merge branch 'main' into environment-locks
akazemier-godaddy 46cf74d
Merge branch 'main' into environment-locks
akazemier-godaddy 3810c4b
chore: merge main into environment-locks
3rd-Eden 558dcda
Merge branch 'environment-locks' of github.com:godaddy/bento into env…
3rd-Eden cbe76cc
chore: merge main - keep data-override disabled by default
3rd-Eden 09861c4
refactor: convert browser tests to use vitest snapshots
3rd-Eden 5fd7f75
docs: clean up
3rd-Eden 5dd38b6
fix: resolve CI failures
3rd-Eden 457d22b
chore: remove withLock HOC - not needed
3rd-Eden 2054f8c
fix: add coverage tests and fix TypeScript errors
3rd-Eden 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,8 @@ | ||
| --- | ||
| "@bento/environment": major | ||
| "@bento/use-props": major | ||
| "@bento/slots": major | ||
| "@bento/box": major | ||
| --- | ||
|
|
||
| data-override attributes are now opt-in using the Environment component | ||
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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,80 @@ | ||
| import { Environment } from '@bento/environment'; | ||
| import { withSlots } from '@bento/slots'; | ||
| import { useProps } from '@bento/use-props'; | ||
| import { Button } from '@bento/button'; | ||
| import { Container } from '@bento/container'; | ||
| import { RadioGroup, Radio } from '@bento/radio'; | ||
| /* v8 ignore next */ | ||
| import React from 'react'; | ||
|
|
||
| /** | ||
| * Interface for component props. | ||
| * | ||
| * @interface ComponentProps | ||
| * @public | ||
| */ | ||
| interface ComponentProps { | ||
| [key: string]: any; | ||
| } | ||
|
|
||
| /** | ||
| * Composite component with internal slots. | ||
| * | ||
| * @param {ComponentProps} props - The component props. | ||
| * @returns {JSX.Element} The rendered composed component. | ||
| * @public | ||
| */ | ||
| const Composed = withSlots('LockNoOverride.Composed', function ComposedComponent(props: ComponentProps) { | ||
| const slots = { | ||
| 'group.label': { className: 'label' }, | ||
| 'group.description': { className: 'describe' } | ||
| }; | ||
|
|
||
| return ( | ||
| <Container slot="root"> | ||
| <Button slot="trigger">Press Me</Button> | ||
| <RadioGroup id="fruit-group" slots={slots} label="Favorite fruit" description="Pick your favorite"> | ||
| <Radio value="apple">Apple</Radio> | ||
| <Radio value="banana">Banana</Radio> | ||
| <Radio value="orange">Orange</Radio> | ||
| </RadioGroup> | ||
| </Container> | ||
| ); | ||
| }); | ||
|
|
||
| /** | ||
| * Design system component with lock boundary. | ||
| * | ||
| * @param {ComponentProps} props - The component props. | ||
| * @returns {JSX.Element} The rendered design system component. | ||
| * @public | ||
| */ | ||
| export const DesignSystemVersion = withSlots( | ||
| 'LockNoOverride.DSVersion', | ||
| function DSVersionComponent(props: ComponentProps) { | ||
| const { props: p } = useProps(props); | ||
| const slots = { | ||
| 'root.trigger': { | ||
| children: 'Click Me' | ||
| } | ||
| }; | ||
|
|
||
| return ( | ||
| <Environment lock={true}> | ||
| <Composed slot="composed" slots={slots} {...p} /> | ||
| </Environment> | ||
| ); | ||
| } | ||
| ); | ||
|
|
||
| /** | ||
| * Example demonstrating lock with NO consumer overrides. | ||
| * Expected: NO data-override attributes anywhere. | ||
| * All slots (trigger, label, description) are internal composition. | ||
| * | ||
| * @returns {JSX.Element} The rendered example. | ||
| * @public | ||
| */ | ||
| export const LockNoOverride: React.FC = function LockNoOverride() { | ||
| return <DesignSystemVersion />; | ||
| }; |
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,16 @@ | ||
| /* v8 ignore next */ | ||
| import React from 'react'; | ||
| // Reuse the components from the lock-no-override example | ||
| import { DesignSystemVersion } from './lock-no-override'; | ||
|
|
||
| /** | ||
| * Example demonstrating lock WITH consumer override. | ||
| * Expected: data-override ONLY on the button (trigger slot). | ||
| * Consumer modifies the trigger slot, internal label/description are not flagged. | ||
| * | ||
| * @returns {JSX.Element} The rendered example. | ||
| * @public | ||
| */ | ||
| export const LockWithOverride: React.FC = function LockWithOverride() { | ||
| return <DesignSystemVersion slots={{ 'composed.root.trigger': { children: 'Hello World' } }} />; | ||
| }; |
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.
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.
These should be minor for now just due to how we are not in a full major release