-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(modal): add modal CSS only pattern
- Loading branch information
Showing
7 changed files
with
322 additions
and
3 deletions.
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
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,54 @@ | ||
{ | ||
"name": "@spectrum-web-components/modal", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/adobe/spectrum-web-components.git", | ||
"directory": "packages/modal" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/adobe/spectrum-web-components/issues" | ||
}, | ||
"homepage": "https://adobe.github.io/spectrum-web-components/components/modal", | ||
"keywords": [ | ||
"spectrum css", | ||
"web components", | ||
"lit-element", | ||
"lit-html" | ||
], | ||
"version": "0.0.1", | ||
"description": "", | ||
"main": "src/modal.css.js", | ||
"module": "src/modal.css.js", | ||
"type": "module", | ||
"exports": { | ||
"./src/": "./src/", | ||
"./custom-elements.json": "./custom-elements.json", | ||
"./package.json": "./package.json" | ||
}, | ||
"files": [ | ||
"custom-elements.json", | ||
"*.d.ts", | ||
"*.js", | ||
"*.js.map", | ||
"/src/" | ||
], | ||
"sideEffects": [ | ||
"./sp-*.js", | ||
"./sp-*.ts" | ||
], | ||
"scripts": { | ||
"test": "echo \"Error: run tests from mono-repo root.\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "Apache-2.0", | ||
"devDependencies": { | ||
"@spectrum-css/modal": "^3.0.0-beta.1" | ||
}, | ||
"dependencies": { | ||
"@spectrum-web-components/base": "^0.1.0", | ||
"tslib": "^2.0.0" | ||
} | ||
} |
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,14 @@ | ||
/* | ||
Copyright 2020 Adobe. All rights reserved. | ||
This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. You may obtain a copy | ||
of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under | ||
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
OF ANY KIND, either express or implied. See the License for the specific language | ||
governing permissions and limitations under the License. | ||
*/ | ||
|
||
@import './spectrum-modal-wrapper.css'; | ||
@import './spectrum-modal.css'; |
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,71 @@ | ||
/* | ||
Copyright 2020 Adobe. All rights reserved. | ||
This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. You may obtain a copy | ||
of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under | ||
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
OF ANY KIND, either express or implied. See the License for the specific language | ||
governing permissions and limitations under the License. | ||
*/ | ||
|
||
const config = { | ||
spectrum: 'modal', | ||
components: [ | ||
{ | ||
name: 'modal-wrapper', | ||
host: { | ||
selector: '.spectrum-Modal-wrapper', | ||
}, | ||
attributes: [ | ||
{ | ||
type: 'boolean', | ||
selector: '.is-open', | ||
name: 'open', | ||
}, | ||
{ | ||
type: 'boolean', | ||
selector: '.spectrum-Modal--responsive', | ||
name: 'responsive', | ||
}, | ||
], | ||
}, | ||
{ | ||
name: 'modal', | ||
host: { | ||
selector: '.spectrum-Modal', | ||
shadowSelector: '.modal', | ||
}, | ||
attributes: [ | ||
{ | ||
type: 'boolean', | ||
selector: '.is-open', | ||
name: 'open', | ||
}, | ||
{ | ||
type: 'boolean', | ||
selector: '.spectrum-Modal--responsive', | ||
name: 'responsive', | ||
}, | ||
], | ||
classes: [ | ||
{ | ||
selector: '.spectrum-Modal', | ||
name: 'dialog', | ||
}, | ||
{ | ||
name: 'fullscreen', | ||
selector: '.spectrum-Modal--fullscreen', | ||
}, | ||
{ | ||
name: 'fullscreenTakeover', | ||
selector: '.spectrum-Modal--fullscreenTakeover', | ||
}, | ||
], | ||
exclude: [/\.spectrum-Modal-wrapper/], | ||
}, | ||
], | ||
}; | ||
|
||
export default config; |
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,41 @@ | ||
/* stylelint-disable */ /* | ||
Copyright 2020 Adobe. All rights reserved. | ||
This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. You may obtain a copy | ||
of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under | ||
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
OF ANY KIND, either express or implied. See the License for the specific language | ||
governing permissions and limitations under the License. | ||
THIS FILE IS MACHINE GENERATED. DO NOT EDIT */ | ||
:host { | ||
/* .spectrum-Modal-wrapper */ | ||
position: fixed; | ||
left: 0; | ||
top: 0; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
box-sizing: border-box; | ||
width: 100vw; | ||
height: 100vh; | ||
height: -webkit-fill-available; | ||
height: -webkit-stretch; | ||
height: -moz-available; | ||
height: fill-available; | ||
visibility: hidden; | ||
pointer-events: none; | ||
z-index: 2; | ||
transition: visibility 0ms linear | ||
var(--spectrum-global-animation-duration-100, 0.13s); | ||
} | ||
:host([open]) { | ||
/* .spectrum-Modal-wrapper.is-open */ | ||
visibility: visible; | ||
} | ||
:host([responsive]) { | ||
/* .spectrum-Modal-wrapper .spectrum-Modal--responsive */ | ||
margin-top: 0; | ||
} |
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,129 @@ | ||
/* stylelint-disable */ /* | ||
Copyright 2020 Adobe. All rights reserved. | ||
This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. You may obtain a copy | ||
of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under | ||
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
OF ANY KIND, either express or implied. See the License for the specific language | ||
governing permissions and limitations under the License. | ||
THIS FILE IS MACHINE GENERATED. DO NOT EDIT */ | ||
.modal { | ||
/* .spectrum-Modal */ | ||
visibility: hidden; | ||
opacity: 0; | ||
transition: transform var(--spectrum-global-animation-duration-100, 0.13s) | ||
ease-in-out, | ||
opacity var(--spectrum-global-animation-duration-100, 0.13s) ease-in-out, | ||
visibility 0ms linear | ||
var(--spectrum-global-animation-duration-100, 0.13s); | ||
pointer-events: none; /* .spectrum-Modal */ | ||
transform: translateY( | ||
var( | ||
--spectrum-dialog-confirm-entry-animation-distance, | ||
var(--spectrum-global-dimension-size-250) | ||
) | ||
); | ||
z-index: 2; | ||
max-height: 90vh; | ||
border-radius: var( | ||
--spectrum-dialog-confirm-border-radius, | ||
var(--spectrum-global-dimension-size-50) | ||
); | ||
overflow: hidden; | ||
outline: none; | ||
pointer-events: auto; | ||
transition: opacity | ||
var( | ||
--spectrum-dialog-confirm-exit-animation-duration, | ||
var(--spectrum-global-animation-duration-100) | ||
) | ||
cubic-bezier(0.5, 0, 1, 1) 0ms, | ||
visibility 0ms linear | ||
calc( | ||
0ms + | ||
var( | ||
--spectrum-dialog-confirm-exit-animation-duration, | ||
var(--spectrum-global-animation-duration-100) | ||
) | ||
), | ||
transform 0ms linear | ||
calc( | ||
0ms + | ||
var( | ||
--spectrum-dialog-confirm-exit-animation-duration, | ||
var(--spectrum-global-animation-duration-100) | ||
) | ||
); /* .spectrum-Modal */ | ||
background: var( | ||
--spectrum-dialog-confirm-background-color, | ||
var(--spectrum-alias-background-color-default) | ||
); | ||
} | ||
:host([open]) .modal { | ||
/* .spectrum-Modal.is-open */ | ||
visibility: visible; | ||
opacity: 1; | ||
transition-delay: 0ms; | ||
pointer-events: auto; /* .spectrum-Modal.is-open */ | ||
transition: transform | ||
var( | ||
--spectrum-dialog-confirm-entry-animation-duration, | ||
var(--spectrum-global-animation-duration-500) | ||
) | ||
cubic-bezier(0, 0, 0.4, 1) | ||
var( | ||
--spectrum-dialog-confirm-entry-animation-delay, | ||
var(--spectrum-global-animation-duration-200) | ||
), | ||
opacity | ||
var( | ||
--spectrum-dialog-confirm-entry-animation-duration, | ||
var(--spectrum-global-animation-duration-500) | ||
) | ||
cubic-bezier(0, 0, 0.4, 1) | ||
var( | ||
--spectrum-dialog-confirm-entry-animation-delay, | ||
var(--spectrum-global-animation-duration-200) | ||
); | ||
transform: translateY(0); | ||
} | ||
:host([responsive]) .modal { | ||
/* .spectrum-Modal--responsive */ | ||
width: 100%; | ||
height: 100%; | ||
max-width: 100%; | ||
max-height: 100%; | ||
border-radius: 0; | ||
} | ||
.fullscreen { | ||
/* .spectrum-Modal--fullscreen */ | ||
position: fixed; | ||
left: 32px; | ||
top: 32px; | ||
right: 32px; | ||
bottom: 32px; | ||
max-width: none; | ||
max-height: none; | ||
} | ||
.fullscreenTakeover { | ||
/* .spectrum-Modal--fullscreenTakeover */ | ||
position: fixed; | ||
left: 0; | ||
right: 0; | ||
top: 0; | ||
bottom: 0; | ||
max-width: none; | ||
max-height: none; | ||
box-sizing: border-box; | ||
border: none; | ||
border-radius: 0; | ||
} | ||
.fullscreenTakeover, | ||
:host([open]) .fullscreenTakeover { | ||
/* .spectrum-Modal--fullscreenTakeover, | ||
* .spectrum-Modal--fullscreenTakeover.is-open */ | ||
transform: none; | ||
} |
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,10 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"composite": true, | ||
"rootDir": "./" | ||
}, | ||
"include": ["*.ts", "src/*.ts"], | ||
"exclude": ["test/*.ts", "stories/*.ts"], | ||
"references": [{ "path": "../base" }] | ||
} |