-
Notifications
You must be signed in to change notification settings - Fork 474
feat(mosaic): add active device dialogs and the DataList component #9800
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4247cff
feat(mosaic): add active device dialogs and the DataList component
maxyinger d6a25f8
fix(swingset): sort the imports the build lints
maxyinger 129b9b3
docs(mosaic): reword the active device dialogs changeset
maxyinger 273405b
fix(mosaic): keep focus off the row a sign out is removing
maxyinger be3715a
docs(mosaic): empty the active device dialogs changeset
maxyinger 9fb6fe9
fix(mosaic): read the device strings through the localization provider
maxyinger 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,2 @@ | ||
| --- | ||
| --- | ||
|
maxyinger marked this conversation as resolved.
|
||
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
56 changes: 56 additions & 0 deletions
56
packages/mosaic/src/components/data-list/data-list.styles.ts
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,56 @@ | ||
| import * as stylex from '@stylexjs/stylex'; | ||
|
|
||
| import { colorVars, fontWeightVars, radiusVars, space, typeScaleVars } from '../../tokens.stylex'; | ||
|
|
||
| export const list = stylex.create({ | ||
| base: { | ||
| borderColor: colorVars['--cl-color-border'], | ||
| borderRadius: radiusVars['--cl-radius-lg'], | ||
| borderStyle: 'solid', | ||
| borderWidth: '1px', | ||
| paddingInline: space['3'], | ||
| backgroundColor: colorVars['--cl-color-background-subtle'], | ||
| display: 'flex', | ||
| flexDirection: 'column', | ||
| width: '100%', | ||
| }, | ||
| }); | ||
|
|
||
| export const item = stylex.create({ | ||
| base: { | ||
| paddingBlock: space['3'], | ||
| alignItems: 'baseline', | ||
| columnGap: space['6'], | ||
| display: 'flex', | ||
| justifyContent: 'space-between', | ||
| }, | ||
| divided: { | ||
| borderBlockEndColor: colorVars['--cl-color-border'], | ||
| borderBlockEndStyle: 'solid', | ||
| borderBlockEndWidth: { | ||
| default: '1px', | ||
| ':last-child': 0, | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| export const label = stylex.create({ | ||
| base: { | ||
| color: colorVars['--cl-color-foreground'], | ||
| flexShrink: 0, | ||
| fontSize: typeScaleVars['--cl-text-sm-size'], | ||
| fontWeight: fontWeightVars['--cl-font-medium'], | ||
| lineHeight: typeScaleVars['--cl-text-sm-leading'], | ||
| }, | ||
| }); | ||
|
|
||
| export const value = stylex.create({ | ||
| base: { | ||
| color: colorVars['--cl-color-foreground-secondary'], | ||
| fontSize: typeScaleVars['--cl-text-sm-size'], | ||
| fontWeight: fontWeightVars['--cl-font-normal'], | ||
| lineHeight: typeScaleVars['--cl-text-sm-leading'], | ||
| textAlign: 'end', | ||
| minWidth: 0, | ||
| }, | ||
| }); |
48 changes: 48 additions & 0 deletions
48
packages/mosaic/src/components/data-list/data-list.test.tsx
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,48 @@ | ||
| import { render, screen } from '@testing-library/react'; | ||
| import { describe, expect, it } from 'vitest'; | ||
|
|
||
| import { MosaicProvider } from '../../MosaicProvider'; | ||
| import { DataList } from './data-list'; | ||
|
|
||
| function renderList(props?: { divided?: boolean }) { | ||
| return render( | ||
| <MosaicProvider> | ||
| <DataList.Root {...props}> | ||
| <DataList.Item> | ||
| <DataList.Label>IP address</DataList.Label> | ||
| <DataList.Value>2600:100e:b10b:787b</DataList.Value> | ||
| </DataList.Item> | ||
| </DataList.Root> | ||
| </MosaicProvider>, | ||
| ); | ||
| } | ||
|
|
||
| describe('DataList', () => { | ||
| it('pairs each value with its label', () => { | ||
| const { container } = renderList(); | ||
|
|
||
| const label = screen.getByText('IP address'); | ||
| const value = screen.getByText('2600:100e:b10b:787b'); | ||
| expect(label.tagName).toBe('DT'); | ||
| expect(value.tagName).toBe('DD'); | ||
| expect(container.querySelector('dl')).toContainElement(label); | ||
| }); | ||
|
|
||
| it('carries the slot classes a theme targets', () => { | ||
| const { container } = renderList(); | ||
|
|
||
| expect(container.querySelector('.cl-data-list')).toBeInTheDocument(); | ||
| expect(container.querySelector('.cl-data-list-item')).toBeInTheDocument(); | ||
| expect(screen.getByText('IP address')).toHaveClass('cl-data-list-label'); | ||
| expect(screen.getByText('2600:100e:b10b:787b')).toHaveClass('cl-data-list-value'); | ||
| }); | ||
|
|
||
| it('reflects whether the items are ruled', () => { | ||
| const { container, unmount } = renderList(); | ||
| expect(container.querySelector('.cl-data-list')).toHaveAttribute('data-divided'); | ||
| unmount(); | ||
|
|
||
| const plain = renderList({ divided: false }); | ||
| expect(plain.container.querySelector('.cl-data-list')).not.toHaveAttribute('data-divided'); | ||
| }); | ||
| }); |
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.
Uh oh!
There was an error while loading. Please reload this page.