Skip to content

Commit e606408

Browse files
author
Luke Bowerman
authored
Dialog Improvements (#1427)
* Major refactor of Dialog, DialogManager, Drawer & useDrawer - `Dialog` - now supports all previous `DialogManager` composition capabilities - can be used in either an "uncontrolled" or "controlled" manner - _temporarily_ supports optional `content` prop until existing call sites can be updated. `content` will become **required** in next significant release. - `DialogManager` is deprecated and all existing use cases should be replaced with `Dialog` - All internal use of `DialogManager` replaced with `Dialog` - `useDrawer` is nearly a direct pass-through to `useDrawer` with the key exception being `Surface` override - `Drawer` is nearly a direct pass-through to `Dialog` via `useDrawer` and `DialogRender` - `useDialog` - all of the power of `Dialog` in a hook! * Harden test-suite * Improve storybook examples, rationalize mocks a bit more * Improve snapshot cropping for Portal components * Extract DrawerSurface more clearly, fix shadow * Update DialogSurface references * Move DOM-mapping of props to useDialog hook ª Allow button to look "active" based on `aria-expanded` (use this within Dialog) * Test coverage for "legacy" Dialog user * Make interface work for "legacy" dialog prop interface as well as * Keep typing on `controlledIsOpen` consistent Co-authored-by: mdodgelooker
1 parent ae5d49a commit e606408

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1380
-1242
lines changed

CHANGELOG.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
## Added
1111

12-
- `Select`, `SelectMulti` and `InputSearch` now support `isLoading` and `detail` prop on options
1312
- `Combobox` and `ComboboxMulti` `openOnClick` prop
1413
- `ComboboxInput` now supports `freeInput` prop
14+
- `MenuItem` & `MenuGroup` now use `list-item-style` to suppress bullet for list item when rendered outside of `MenuList` context.
15+
- `Select`, `SelectMulti` and `InputSearch` now support `isLoading` and `detail` prop on options
1516
- `Span` - same as `Text` without the annoying `fontSize="medium"` (inherits by default instead)
1617
- `Truncate` component
18+
- `useDialog` - all of the power of `Dialog` in a hook!
1719
- Visual Snapshot test for `MenuItem`, `MenuGroup`, `Status`
18-
- `MenuItem` & `MenuGroup` now use `list-item-style` to suppress bullet for list item when rendered outside of `MenuList` context.
1920

2021
## Changed
2122

23+
- `Code`, `CodeBlock` & `Paragraph` now explicitly use `theme.colors.text` as default color
24+
- `Dialog`
25+
- `Backdrop` is now dark (Material-esque)
26+
- now supports all previous `DialogManager` composition capabilities
27+
- can be used in either an "uncontrolled" or "controlled" manner
28+
- _temporarily_ supports optional `content` prop until existing call sites can be updated. `content` will become **required** in next significant release.
29+
- `DialogManager` is deprecated and all existing use cases should be replaced with `Dialog`
30+
- All internal use of `DialogManager` replaced with `Dialog`
31+
- `Drawer` is nearly a direct pass-through to `Dialog` via `useDrawer` and `DialogRender`
32+
- `useDrawer` is nearly a direct pass-through to `useDrawer` with the key exception being `Surface` override
33+
- `HoverDisclosure` toggles visibility with css rather than inserting elements into the DOM
34+
- `InputSearch` `onChange` callback argument is now a string rather than an event
35+
- `InputTimeSelect` supports 20- and 60-minute intervals
36+
- `Span` replaced all library-internal usage of `Text` with `Span`
2237
- `TreeItem` now supports text truncation behavior
2338
- `TreeItem` now wraps long text pleasantly
2439
- `TreeItem` now defaults to `24px` minimum height (was previously `25px`)
25-
- `HoverDisclosure` toggles visibility with css rather than inserting elements into the DOM
2640
- `Tooltip` now has a default `maxWidth` of `30rem` (this can be overridden)
27-
- `Span` replaced all library-internal usage of `Text` with `Span`
28-
- `Code`, `CodeBlock` & `Paragraph` now explicitly use `theme.colors.text` as default color
2941
- `TreeItem`'s detail no longer has padding on the right side
30-
- `InputSearch` `onChange` callback argument is now a string rather than an event
31-
- `InputTimeSelect` supports 20- and 60-minute intervals
3242
- Brand font defaults to Roboto
3343

3444
### Fixed

packages/components-theme-editor/src/ThemeEditor.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
2525
*/
2626

27-
import { IconButton, DialogManager } from '@looker/components'
27+
import { IconButton, Dialog } from '@looker/components'
2828
import React, { FC } from 'react'
2929
import {
3030
ThemeEditorContent,
@@ -41,7 +41,7 @@ export const ThemeEditor: FC<ThemeEditorProps> = ({
4141
hasCustomTheme,
4242
updateTheme,
4343
}) => (
44-
<DialogManager
44+
<Dialog
4545
content={<ThemeEditorContent updateTheme={updateTheme} />}
4646
width="90%"
4747
maxWidth="90%"
@@ -53,5 +53,5 @@ export const ThemeEditor: FC<ThemeEditorProps> = ({
5353
color={hasCustomTheme ? 'key' : 'neutral'}
5454
size="small"
5555
/>
56-
</DialogManager>
56+
</Dialog>
5757
)
55.9 KB
Loading
35 KB
Loading
8.58 KB
Loading
58.3 KB
Loading
63.5 KB
Loading

packages/components/src/Button/Button.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export const Button = styled(ButtonBase)`
4141
theme.colors[`${color}Interactive`]};
4242
}
4343
44+
&[aria-expanded='true'],
4445
&:active,
4546
&.active {
4647
background: ${({ theme, color = 'key' }) =>

packages/components/src/Button/ButtonOutline.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export const ButtonOutline = styled(ButtonBase)`
3939
color: ${({ theme, color = 'key' }) => theme.colors[`${color}`]};
4040
}
4141
42+
&[aria-expanded='true'],
4243
&:active,
4344
&.active {
4445
background: ${({ theme, color = 'key' }) => theme.colors[`${color}Accent`]};

packages/components/src/Button/ButtonTransparent.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export const ButtonTransparent = styled(ButtonBase)`
6767
theme.colors[`${color}Subtle`]};
6868
}
6969
70+
&[aria-expanded='true'],
7071
&:active,
7172
&.active {
7273
background: ${({ theme, color = 'key' }) => theme.colors[`${color}Accent`]};

0 commit comments

Comments
 (0)