Skip to content

Commit

Permalink
feat(dialog): update spectrum css input
Browse files Browse the repository at this point in the history
  • Loading branch information
Westbrook Johnson authored and Westbrook committed Jan 6, 2021
1 parent 4fd3585 commit 405ca5e
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 49 deletions.
5 changes: 3 additions & 2 deletions packages/dialog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@
"author": "",
"license": "Apache-2.0",
"devDependencies": {
"@spectrum-css/dialog": "^3.0.0-beta.5"
"@spectrum-css/dialog": "^3.0.0-beta.6"
},
"dependencies": {
"@spectrum-web-components/base": "^0.1.3",
"@spectrum-web-components/button": "^0.9.4",
"@spectrum-web-components/action-button": "^0.0.1",
"@spectrum-web-components/icon": "^0.6.3",
"@spectrum-web-components/icons-ui": "^0.3.3",
"@spectrum-web-components/icons-workflow": "^0.3.6",
"@spectrum-web-components/modal": "^0.0.1",
"@spectrum-web-components/shared": "^0.7.4",
"@spectrum-web-components/underlay": "^0.3.3",
Expand Down
52 changes: 27 additions & 25 deletions packages/dialog/src/Dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,11 @@ import {
} from '@spectrum-web-components/base';

import '@spectrum-web-components/rule/sp-rule.js';
import '@spectrum-web-components/button/sp-action-button.js';
import alertMediumStyles from '@spectrum-web-components/icon/src/spectrum-icon-alert-medium.css.js';
import crossLargeStyles from '@spectrum-web-components/icon/src/spectrum-icon-cross-large.css.js';
import '@spectrum-web-components/action-button/sp-action-button.js';
import crossStyles from '@spectrum-web-components/icon/src/spectrum-icon-cross.css.js';
import '@spectrum-web-components/icon/sp-icon.js';
import {
AlertMediumIcon,
CrossLargeIcon,
} from '@spectrum-web-components/icons-ui';
import { Cross500Icon } from '@spectrum-web-components/icons-ui';
import { AlertIcon } from '@spectrum-web-components/icons-workflow';
import { ObserveSlotPresence } from '@spectrum-web-components/shared';

import styles from './dialog.css.js';
Expand All @@ -44,7 +41,7 @@ export class Dialog extends ObserveSlotPresence(SpectrumElement, [
'[slot="button"]',
]) {
public static get styles(): CSSResultArray {
return [styles, alertMediumStyles, crossLargeStyles];
return [styles, crossStyles];
}

@query('.content')
Expand Down Expand Up @@ -117,29 +114,15 @@ export class Dialog extends ObserveSlotPresence(SpectrumElement, [
></slot>
${this.error
? html`
<sp-icon class="type-icon alert-medium">
${AlertMediumIcon({ hidden: true })}
<sp-icon class="type-icon">
${AlertIcon({ hidden: true })}
</sp-icon>
`
: html``}
${this.dismissable
? html`
<sp-action-button
class="close-button"
label="Close"
quiet
@click=${this.close}
>
<sp-icon class="cross-large">
${CrossLargeIcon({ hidden: true })}
</sp-icon>
</sp-action-button>
`
: html``}
${this.noDivider
? html``
: html`
<sp-rule size="medium" class="divider"></sp-rule>
<sp-rule size="m" class="divider"></sp-rule>
`}
<div class="content">
<slot @slotchange=${this.onContentSlotChange}></slot>
Expand All @@ -162,6 +145,25 @@ export class Dialog extends ObserveSlotPresence(SpectrumElement, [
</sp-button-group>
`
: html``}
${this.dismissable
? html`
<sp-action-button
class="close-button"
label="Close"
quiet
size="m"
@click=${this.close}
>
<sp-icon
class="spectrum-UIIcon-Cross500"
size="m"
slot="icon"
>
${Cross500Icon()}
</sp-icon>
</sp-action-button>
`
: html``}
</div>
`;
}
Expand Down
32 changes: 12 additions & 20 deletions packages/dialog/src/spectrum-dialog.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,9 @@ THIS FILE IS MACHINE GENERATED. DO NOT EDIT */
.grid {
/* .spectrum-Dialog .spectrum-Dialog-grid */
display: grid;
grid-template-columns: var(--spectrum-dialog-confirm-padding) auto 1fr auto minmax(
0,
auto
) var(--spectrum-dialog-confirm-padding);
grid-template-columns:
var(--spectrum-dialog-confirm-padding) auto 1fr auto minmax(0, auto)
var(--spectrum-dialog-confirm-padding);
grid-template-rows: auto var(--spectrum-dialog-confirm-padding) auto auto 1fr auto var(
--spectrum-dialog-confirm-padding
);
Expand Down Expand Up @@ -193,12 +192,9 @@ THIS FILE IS MACHINE GENERATED. DO NOT EDIT */
}
:host([dismissable]) .grid {
/* .spectrum-Dialog.spectrum-Dialog--dismissable .spectrum-Dialog-grid */
grid-template-columns: var(--spectrum-dialog-confirm-padding) auto 1fr auto minmax(
0,
auto
) minmax(0, var(--spectrum-global-dimension-size-400)) var(
--spectrum-dialog-confirm-padding
);
grid-template-columns:
var(--spectrum-dialog-confirm-padding) auto 1fr auto minmax(0, auto)
minmax(0, var(--spectrum-global-dimension-size-400)) var(--spectrum-dialog-confirm-padding);
grid-template-rows: auto var(--spectrum-dialog-confirm-padding) auto auto 1fr auto var(
--spectrum-dialog-confirm-padding
);
Expand Down Expand Up @@ -299,10 +295,9 @@ THIS FILE IS MACHINE GENERATED. DO NOT EDIT */
}
@media screen and (max-inline-size: 700px) {
.grid {
grid-template-columns: var(--spectrum-dialog-confirm-padding) auto 1fr auto minmax(
0,
auto
) var(--spectrum-dialog-confirm-padding);
grid-template-columns:
var(--spectrum-dialog-confirm-padding) auto 1fr auto minmax(0, auto)
var(--spectrum-dialog-confirm-padding);
grid-template-areas: 'hero hero hero hero hero hero' '. . . . . .' '. heading heading heading typeIcon .' '. header header header header .' '. divider divider divider divider .' '. content content content content .' '. footer footer buttonGroup buttonGroup .' '. . . . . .';
}
:host([dismissable]) .grid,
Expand All @@ -312,12 +307,9 @@ THIS FILE IS MACHINE GENERATED. DO NOT EDIT */
);
}
:host([dismissable]) .grid {
grid-template-columns: var(--spectrum-dialog-confirm-padding) auto 1fr auto minmax(
0,
auto
) minmax(0, var(--spectrum-global-dimension-size-400)) var(
--spectrum-dialog-confirm-padding
);
grid-template-columns:
var(--spectrum-dialog-confirm-padding) auto 1fr auto minmax(0, auto)
minmax(0, var(--spectrum-global-dimension-size-400)) var(--spectrum-dialog-confirm-padding);
grid-template-areas: 'hero hero hero hero hero hero hero' '. . . . . closeButton closeButton' '. heading heading heading typeIcon closeButton closeButton' '. header header header header header .' '. divider divider divider divider divider .' '. content content content content content .' '. footer footer buttonGroup buttonGroup buttonGroup .' '. . . . . . .';
}
.header {
Expand Down
3 changes: 2 additions & 1 deletion packages/dialog/test/dialog-wrapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import { spy } from 'sinon';

import '../sp-dialog-wrapper.js';
import { Dialog, DialogWrapper } from '../';
import { Button, ActionButton } from '@spectrum-web-components/button';
import { ActionButton } from '@spectrum-web-components/action-button';
import { Button } from '@spectrum-web-components/button';
import { Underlay } from '@spectrum-web-components/underlay';
import {
wrapperLabeledHero,
Expand Down
4 changes: 3 additions & 1 deletion packages/dialog/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
"include": ["*.ts", "src/*.ts"],
"exclude": ["test/*.ts", "stories/*.ts"],
"references": [
{ "path": "../button" },
{ "path": "../action-button" },
{ "path": "../icons-ui" },
{ "path": "../icons-workflow" },
{ "path": "../shared" },
{ "path": "../underlay" }
]
Expand Down

0 comments on commit 405ca5e

Please sign in to comment.