@primer/view-components 0.17.0-rc.9afdc6fe → 0.17.0-rc.b11263cc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/assets/javascripts/app/components/primer/dialog_helper.d.ts +15 -0
- package/app/assets/javascripts/app/components/primer/primer.d.ts +1 -0
- package/app/assets/javascripts/primer_view_components.js +1 -1
- package/app/assets/javascripts/primer_view_components.js.map +1 -1
- package/app/assets/styles/primer_view_components.css +1 -1
- package/app/assets/styles/primer_view_components.css.map +1 -1
- package/app/components/primer/alpha/action_menu/action_menu_element.js +8 -0
- package/app/components/primer/alpha/dialog.css +1 -1
- package/app/components/primer/alpha/dialog.css.json +10 -27
- package/app/components/primer/alpha/overlay.css +1 -1
- package/app/components/primer/alpha/overlay.css.json +1 -0
- package/app/components/primer/dialog_helper.d.ts +15 -0
- package/app/components/primer/dialog_helper.js +77 -0
- package/app/components/primer/primer.d.ts +1 -0
- package/app/components/primer/primer.js +1 -0
- package/package.json +1 -1
- package/static/classes.json +5 -20
- package/static/constants.json +7 -7
@@ -312,7 +312,15 @@ _ActionMenuElement_handleDialogItemActivated = function _ActionMenuElement_handl
|
|
312
312
|
if (__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_isOpen).call(this)) {
|
313
313
|
__classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_hide).call(this);
|
314
314
|
}
|
315
|
+
const activeElement = this.ownerDocument.activeElement;
|
316
|
+
const lostFocus = this.ownerDocument.activeElement === this.ownerDocument.body;
|
317
|
+
const focusInClosedMenu = this.contains(activeElement);
|
318
|
+
if (lostFocus || focusInClosedMenu) {
|
319
|
+
setTimeout(() => { var _a; return (_a = this.invokerElement) === null || _a === void 0 ? void 0 : _a.focus(); }, 0);
|
320
|
+
}
|
315
321
|
};
|
322
|
+
// a modal <dialog> element will close all popovers
|
323
|
+
setTimeout(() => __classPrivateFieldGet(this, _ActionMenuElement_instances, "m", _ActionMenuElement_show).call(this), 0);
|
316
324
|
dialog.addEventListener('close', handleDialogClose, { signal });
|
317
325
|
dialog.addEventListener('cancel', handleDialogClose, { signal });
|
318
326
|
};
|
@@ -1 +1 @@
|
|
1
|
-
.Overlay--hidden{display:none!important}.Overlay--visibilityHidden{height:0;opacity:0;overflow:hidden;visibility:hidden}.Overlay{background-color:var(--overlay-bgColor,var(--color-canvas-overlay));border-radius:var(--borderRadius-large,.75rem);box-shadow:var(--shadow-floating-small,var(--color-overlay-shadow));display:flex;flex-direction:column;max-height:min(calc(100vh - 2rem),var(--overlay-height));min-width:192px;opacity:1;white-space:normal;width:min(var(--overlay-width),100vw - 2rem)}.Overlay.Overlay--size-auto{max-height:calc(100vh - 2rem);max-width:calc(100vw - 2rem);min-width:192px}.Overlay.Overlay--size-full{height:100vh;width:100vw}.Overlay.Overlay--size-xsmall{--overlay-width:192px;max-height:calc(100vh - 2rem)}.Overlay.Overlay--size-small{--overlay-height:256px;--overlay-width:320px}.Overlay.Overlay--size-small-portrait{--overlay-height:432px;--overlay-width:320px}.Overlay.Overlay--size-medium{--overlay-height:320px;--overlay-width:480px}.Overlay.Overlay--size-medium-portrait{--overlay-height:600px;--overlay-width:480px}.Overlay.Overlay--size-large{--overlay-height:432px;--overlay-width:640px}.Overlay.Overlay--size-xlarge{--overlay-height:600px;--overlay-width:960px}.Overlay.Overlay--height-auto{height:auto}.Overlay.Overlay--height-xsmall{height:min(192px,100vh - 2rem)}.Overlay.Overlay--height-small{height:min(256px,100vh - 2rem)}.Overlay.Overlay--height-medium{height:min(320px,100vh - 2rem)}.Overlay.Overlay--height-large{height:min(432px,100vh - 2rem)}.Overlay.Overlay--height-xlarge{height:min(600px,100vh - 2rem)}.Overlay.Overlay--width-auto{width:auto}.Overlay.Overlay--width-small{width:min(256px,100vw - 2rem)}.Overlay.Overlay--width-medium{width:min(320px,100vw - 2rem)}.Overlay.Overlay--width-large{width:min(480px,100vw - 2rem)}.Overlay.Overlay--width-xlarge{width:min(640px,100vw - 2rem)}.Overlay.Overlay--width-xxlarge{width:min(960px,100vw - 2rem)}@media screen and (prefers-reduced-motion:no-preference){.Overlay.Overlay--motion-scaleFade{animation:Overlay--motion-scaleFade .2s cubic-bezier(.33,1,.68,1) 0s 1 normal none running}}@keyframes Overlay--motion-scaleFade{0%{opacity:0;transform:scale(.5)}to{opacity:1;transform:scale(1)}}.Overlay-form{flex-grow:1;overflow:auto}.Overlay-form,.Overlay-header{display:flex;flex-direction:column}.Overlay-header{color:var(--fgColor-default,var(--color-fg-default));z-index:1}.Overlay-header.Overlay-header--divided{box-shadow:inset 0 calc(var(--borderWidth-thin,max(1px, .0625rem))*-1) var(--borderColor-default,var(--color-border-default));padding-bottom:var(--stack-padding-condensed,.5rem)}.Overlay-header.Overlay-header--divided+.Overlay-body{padding-top:var(--stack-padding-normal,1rem)}.Overlay-header.Overlay-header--large .Overlay-headerContentWrap .Overlay-titleWrap{gap:var(--stack-gap-condensed,.5rem)}.Overlay-header.Overlay-header--large .Overlay-headerContentWrap .Overlay-titleWrap .Overlay-title{font-size:var(--text-title-size-medium,1.25rem)}.Overlay-header.Overlay-header--large .Overlay-headerContentWrap .Overlay-titleWrap .Overlay-description{font-size:var(--text-body-size-medium,.875rem)}.Overlay-header .Overlay-headerContentWrap{align-items:flex-start;display:flex;gap:var(--stack-gap-condensed,.5rem);padding:var(--stack-gap-condensed,.5rem) var(--stack-gap-condensed,.5rem) 0 var(--stack-gap-condensed,.5rem)}.Overlay-header .Overlay-headerContentWrap .Overlay-actionWrap{display:flex;flex-direction:row;gap:var(--stack-gap-condensed,.5rem)}.Overlay-header .Overlay-headerContentWrap .Overlay-titleWrap{display:flex;flex-direction:column;flex-grow:1;gap:var(--control-small-gap,.25rem);padding:calc(var(--stack-gap-condensed,.5rem)*.75) 0 calc(var(--stack-gap-condensed,.5rem)*.75) var(--stack-gap-condensed,.5rem)}.Overlay-header .Overlay-headerContentWrap .Overlay-titleWrap .Overlay-title{font-size:var(--text-body-size-medium,.875rem);font-weight:var(--base-text-weight-semibold,600);margin:0}.Overlay-header .Overlay-headerContentWrap .Overlay-titleWrap .Overlay-description{color:var(--fgColor-muted,var(--color-fg-muted));font-size:var(--text-body-size-small,.75rem);font-weight:var(--base-text-weight-normal,400);margin:0}.Overlay-body{flex-grow:1;font-size:var(--text-body-size-medium,.875rem);overflow-y:auto;padding:var(--stack-padding-normal,1rem);padding-top:0;scrollbar-width:thin}.Overlay-body.Overlay-body--paddingCondensed{padding:var(--stack-padding-condensed,.5rem);padding-top:0}.Overlay-body.Overlay-body--paddingNone{padding:0}.Overlay-footer{display:flex;flex-direction:row;flex-shrink:0;flex-wrap:wrap;padding:0 var(--stack-padding-normal,1rem) var(--stack-padding-normal,1rem) var(--stack-padding-normal,1rem);z-index:1}.Overlay-footer.Overlay-footer--divided{box-shadow:inset 0 var(--borderWidth-thin,max(1px,.0625rem)) var(--borderColor-default,var(--color-border-default));padding-top:var(--stack-padding-normal,1rem)}.Overlay-footer.Overlay-footer--alignStart{gap:var(--stack-gap-condensed,.5rem);justify-content:flex-start}.Overlay-footer.Overlay-footer--alignCenter{gap:var(--stack-gap-condensed,.5rem);justify-content:center}.Overlay-footer.Overlay-footer--alignEnd{gap:var(--stack-gap-condensed,.5rem);justify-content:flex-end}.Overlay-closeButton{align-self:flex-start;background-color:initial;border:var(--borderWidth-thin,max(1px,.0625rem)) solid #0000;border-radius:var(--borderRadius-medium,.375rem);color:var(--fgColor-muted,var(--color-fg-muted));cursor:pointer;display:grid;flex-shrink:0;height:var(--base-size-32,2rem);padding:0;place-content:center;position:relative;transition:.2s cubic-bezier(.3,0,.5,1);transition-property:color,background-color,border-color;-webkit-user-select:none;user-select:none;width:var(--base-size-32,2rem)}.Overlay-closeButton:focus,.Overlay-closeButton:hover{background-color:var(--button-default-bgColor-hover,var(--color-btn-hover-bg));border:var(--borderWidth-thin,max(1px,.0625rem)) solid var(--control-bgColor-hover,var(--color-btn-hover-bg))}.Overlay-closeButton.close-button{border:var(--borderWidth-thin,max(1px,.0625rem)) solid #0000}.Overlay-backdrop--center{align-items:center;background-color:var(--overlay-backdrop-bgColor,var(--color-neutral-muted));bottom:0;display:flex;justify-content:center;left:0;position:fixed;right:0;top:0;z-index:999}.Overlay-backdrop--anchor{background-color:initial;position:absolute;z-index:999}.Overlay-backdrop--side{background-color:var(--overlay-backdrop-bgColor,var(--color-neutral-muted));bottom:0;display:flex;left:0;position:fixed;right:0;top:0;z-index:999}.Overlay-backdrop--side,.Overlay-backdrop--side.Overlay-backdrop--placement-left{align-items:center;justify-content:left}.Overlay-backdrop--side.Overlay-backdrop--placement-left>.Overlay{border-radius:var(--borderRadius-large,.75rem);border-bottom-left-radius:0;border-top-left-radius:0;height:100vh;max-height:unset}@media screen and (prefers-reduced-motion:no-preference){.Overlay-backdrop--side.Overlay-backdrop--placement-left>.Overlay{animation:Overlay--motion-slideInRight .25s cubic-bezier(.33,1,.68,1) 0s 1 normal none running}}.Overlay-backdrop--side.Overlay-backdrop--placement-right{align-items:center;justify-content:right}.Overlay-backdrop--side.Overlay-backdrop--placement-right>.Overlay{border-radius:var(--borderRadius-large,.75rem);border-bottom-right-radius:0;border-top-right-radius:0;height:100vh;max-height:unset}@media screen and (prefers-reduced-motion:no-preference){.Overlay-backdrop--side.Overlay-backdrop--placement-right>.Overlay{animation:Overlay--motion-slideInLeft .25s cubic-bezier(.33,1,.68,1) 0s 1 normal none running}}.Overlay-backdrop--side.Overlay-backdrop--placement-bottom{align-items:end;justify-content:center}.Overlay-backdrop--side.Overlay-backdrop--placement-bottom>.Overlay{border-radius:var(--borderRadius-large,.75rem);border-bottom-left-radius:0;border-bottom-right-radius:0;height:auto;max-height:calc(100vh - 2rem);width:100vw}@media screen and (prefers-reduced-motion:no-preference){.Overlay-backdrop--side.Overlay-backdrop--placement-bottom>.Overlay{animation:Overlay--motion-slideUp .25s cubic-bezier(.33,1,.68,1) 0s 1 normal none running}}.Overlay-backdrop--side.Overlay-backdrop--placement-top{align-items:start;justify-content:center}.Overlay-backdrop--side.Overlay-backdrop--placement-top>.Overlay{border-radius:var(--borderRadius-large,.75rem);border-top-left-radius:0;border-top-right-radius:0}@media screen and (prefers-reduced-motion:no-preference){.Overlay-backdrop--side.Overlay-backdrop--placement-top>.Overlay{animation:Overlay--motion-slideDown .25s cubic-bezier(.33,1,.68,1) 0s 1 normal none running}}.Overlay-backdrop--full{background-color:var(--overlay-backdrop-bgColor,var(--color-neutral-muted));bottom:0;display:flex;left:0;position:fixed;right:0;top:0;z-index:999}.Overlay-backdrop--full .Overlay{border-radius:unset!important;flex-grow:1;height:100%;max-height:100vh;max-width:100vw;width:100%}@media (max-width:767px){.Overlay-backdrop--center-whenNarrow{align-items:center;background-color:var(--overlay-backdrop-bgColor,var(--color-neutral-muted));bottom:0;display:flex;justify-content:center;left:0;position:fixed;right:0;top:0;z-index:999}.Overlay-backdrop--anchor-whenNarrow{background-color:initial;position:absolute;z-index:999}.Overlay-backdrop--side-whenNarrow{background-color:var(--overlay-backdrop-bgColor,var(--color-neutral-muted));bottom:0;display:flex;left:0;position:fixed;right:0;top:0;z-index:999}.Overlay-backdrop--side-whenNarrow,.Overlay-backdrop--side-whenNarrow.Overlay-backdrop--placement-left-whenNarrow{align-items:center;justify-content:left}.Overlay-backdrop--side-whenNarrow.Overlay-backdrop--placement-left-whenNarrow>.Overlay-whenNarrow{border-radius:var(--borderRadius-large,.75rem);border-bottom-left-radius:0;border-top-left-radius:0;height:100vh;max-height:unset}@media screen and (prefers-reduced-motion:no-preference){.Overlay-backdrop--side-whenNarrow.Overlay-backdrop--placement-left-whenNarrow>.Overlay-whenNarrow{animation:Overlay--motion-slideInRight .25s cubic-bezier(.33,1,.68,1) 0s 1 normal none running}}.Overlay-backdrop--side-whenNarrow.Overlay-backdrop--placement-right-whenNarrow{align-items:center;justify-content:right}.Overlay-backdrop--side-whenNarrow.Overlay-backdrop--placement-right-whenNarrow>.Overlay-whenNarrow{border-radius:var(--borderRadius-large,.75rem);border-bottom-right-radius:0;border-top-right-radius:0;height:100vh;max-height:unset}@media screen and (prefers-reduced-motion:no-preference){.Overlay-backdrop--side-whenNarrow.Overlay-backdrop--placement-right-whenNarrow>.Overlay-whenNarrow{animation:Overlay--motion-slideInLeft .25s cubic-bezier(.33,1,.68,1) 0s 1 normal none running}}.Overlay-backdrop--side-whenNarrow.Overlay-backdrop--placement-bottom-whenNarrow{align-items:end;justify-content:center}.Overlay-backdrop--side-whenNarrow.Overlay-backdrop--placement-bottom-whenNarrow>.Overlay-whenNarrow{border-radius:var(--borderRadius-large,.75rem);border-bottom-left-radius:0;border-bottom-right-radius:0;height:auto;max-height:calc(100vh - 2rem);width:100vw}@media screen and (prefers-reduced-motion:no-preference){.Overlay-backdrop--side-whenNarrow.Overlay-backdrop--placement-bottom-whenNarrow>.Overlay-whenNarrow{animation:Overlay--motion-slideUp .25s cubic-bezier(.33,1,.68,1) 0s 1 normal none running}}.Overlay-backdrop--side-whenNarrow.Overlay-backdrop--placement-top-whenNarrow{align-items:start;justify-content:center}.Overlay-backdrop--side-whenNarrow.Overlay-backdrop--placement-top-whenNarrow>.Overlay-whenNarrow{border-radius:var(--borderRadius-large,.75rem);border-top-left-radius:0;border-top-right-radius:0}@media screen and (prefers-reduced-motion:no-preference){.Overlay-backdrop--side-whenNarrow.Overlay-backdrop--placement-top-whenNarrow>.Overlay-whenNarrow{animation:Overlay--motion-slideDown .25s cubic-bezier(.33,1,.68,1) 0s 1 normal none running}}.Overlay-backdrop--full-whenNarrow{background-color:var(--overlay-backdrop-bgColor,var(--color-neutral-muted));bottom:0;display:flex;left:0;position:fixed;right:0;top:0;z-index:999}.Overlay-backdrop--full-whenNarrow .Overlay{border-radius:unset!important;flex-grow:1;height:100%;max-height:100vh;max-width:100vw;width:100%}}@keyframes Overlay--motion-slideDown{0%{transform:translateY(-100%)}}@keyframes Overlay--motion-slideUp{0%{transform:translateY(100%)}}@keyframes Overlay--motion-slideInRight{0%{transform:translateX(-100%)}}@keyframes Overlay--motion-slideInLeft{0%{transform:translateX(100%)}}
|
1
|
+
dialog.Overlay:not([open]){display:none}.Overlay--hidden{display:none!important}.Overlay--visibilityHidden{height:0;opacity:0;overflow:hidden;visibility:hidden}.Overlay{background-color:var(--overlay-bgColor,var(--color-canvas-overlay));border:0;border-radius:var(--borderRadius-large,.75rem);box-shadow:var(--shadow-floating-small,var(--color-overlay-shadow));color:var(--fgColor-default,var(--color-fg-default));display:flex;flex-direction:column;inset:0;margin:auto;max-height:min(calc(100vh - 2rem),var(--overlay-height));min-width:192px;opacity:1;padding:0;position:static;white-space:normal;width:min(var(--overlay-width),100vw - 2rem)}.Overlay.Overlay--size-auto{max-height:calc(100vh - 2rem);max-width:calc(100vw - 2rem);min-width:192px}.Overlay.Overlay--size-full{height:100vh;width:100vw}.Overlay.Overlay--size-xsmall{--overlay-width:192px;max-height:calc(100vh - 2rem)}.Overlay.Overlay--size-small{--overlay-height:256px;--overlay-width:320px}.Overlay.Overlay--size-small-portrait{--overlay-height:432px;--overlay-width:320px}.Overlay.Overlay--size-medium{--overlay-height:320px;--overlay-width:480px}.Overlay.Overlay--size-medium-portrait{--overlay-height:600px;--overlay-width:480px}.Overlay.Overlay--size-large{--overlay-height:432px;--overlay-width:640px}.Overlay.Overlay--size-xlarge{--overlay-height:600px;--overlay-width:960px}.Overlay.Overlay--height-auto{height:auto}.Overlay.Overlay--placement-left,.Overlay.Overlay--placement-right{height:100%;max-height:unset;position:fixed}@media screen and (prefers-reduced-motion:no-preference){.Overlay.Overlay--motion-scaleFade,.Overlay.Overlay--placement-left,.Overlay.Overlay--placement-right{animation:Overlay--motion-scaleFade .2s cubic-bezier(.33,1,.68,1) 0s 1 normal none running}}.Overlay.Overlay--placement-left{animation-name:Overlay--motion-slideInRight;border-bottom-left-radius:0;border-top-left-radius:0;inset:0 auto 0 0}.Overlay.Overlay--placement-right{animation-name:Overlay--motion-slideInLeft;border-bottom-right-radius:0;border-top-right-radius:0;inset:0 0 0 auto}.Overlay.Overlay--height-xsmall{height:min(192px,100vh - 2rem)}.Overlay.Overlay--height-small{height:min(256px,100vh - 2rem)}.Overlay.Overlay--height-medium{height:min(320px,100vh - 2rem)}.Overlay.Overlay--height-large{height:min(432px,100vh - 2rem)}.Overlay.Overlay--height-xlarge{height:min(600px,100vh - 2rem)}.Overlay.Overlay--width-auto{width:auto}.Overlay.Overlay--width-small{width:min(256px,100vw - 2rem)}.Overlay.Overlay--width-medium{width:min(320px,100vw - 2rem)}.Overlay.Overlay--width-large{width:min(480px,100vw - 2rem)}.Overlay.Overlay--width-xlarge{width:min(640px,100vw - 2rem)}.Overlay.Overlay--width-xxlarge{width:min(960px,100vw - 2rem)}@keyframes Overlay--motion-scaleFade{0%{opacity:0;transform:scale(.5)}to{opacity:1;transform:scale(1)}}.Overlay-form{flex-grow:1;overflow:auto}.Overlay-form,.Overlay-header{display:flex;flex-direction:column}.Overlay-header{color:var(--fgColor-default,var(--color-fg-default));z-index:1}.Overlay-header.Overlay-header--divided{box-shadow:inset 0 calc(var(--borderWidth-thin,max(1px, .0625rem))*-1) var(--borderColor-default,var(--color-border-default));padding-bottom:var(--stack-padding-condensed,.5rem)}.Overlay-header.Overlay-header--divided+.Overlay-body{padding-top:var(--stack-padding-normal,1rem)}.Overlay-header.Overlay-header--large .Overlay-headerContentWrap .Overlay-titleWrap{gap:var(--stack-gap-condensed,.5rem)}.Overlay-header.Overlay-header--large .Overlay-headerContentWrap .Overlay-titleWrap .Overlay-title{font-size:var(--text-title-size-medium,1.25rem)}.Overlay-header.Overlay-header--large .Overlay-headerContentWrap .Overlay-titleWrap .Overlay-description{font-size:var(--text-body-size-medium,.875rem)}.Overlay-header .Overlay-headerContentWrap{align-items:flex-start;display:flex;gap:var(--stack-gap-condensed,.5rem);padding:var(--stack-gap-condensed,.5rem) var(--stack-gap-condensed,.5rem) 0 var(--stack-gap-condensed,.5rem)}.Overlay-header .Overlay-headerContentWrap .Overlay-actionWrap{display:flex;flex-direction:row;gap:var(--stack-gap-condensed,.5rem)}.Overlay-header .Overlay-headerContentWrap .Overlay-titleWrap{display:flex;flex-direction:column;flex-grow:1;gap:var(--control-small-gap,.25rem);padding:calc(var(--stack-gap-condensed,.5rem)*.75) 0 calc(var(--stack-gap-condensed,.5rem)*.75) var(--stack-gap-condensed,.5rem)}.Overlay-header .Overlay-headerContentWrap .Overlay-titleWrap .Overlay-title{font-size:var(--text-body-size-medium,.875rem);font-weight:var(--base-text-weight-semibold,600);margin:0}.Overlay-header .Overlay-headerContentWrap .Overlay-titleWrap .Overlay-description{color:var(--fgColor-muted,var(--color-fg-muted));font-size:var(--text-body-size-small,.75rem);font-weight:var(--base-text-weight-normal,400);margin:0}.Overlay-body{flex-grow:1;font-size:var(--text-body-size-medium,.875rem);overflow-y:auto;padding:var(--stack-padding-normal,1rem);padding-top:0;scrollbar-width:thin}.Overlay-body.Overlay-body--paddingCondensed{padding:var(--stack-padding-condensed,.5rem);padding-top:0}.Overlay-body.Overlay-body--paddingNone{padding:0}.Overlay-footer{display:flex;flex-direction:row;flex-shrink:0;flex-wrap:wrap;padding:0 var(--stack-padding-normal,1rem) var(--stack-padding-normal,1rem) var(--stack-padding-normal,1rem);z-index:1}.Overlay-footer.Overlay-footer--divided{box-shadow:inset 0 var(--borderWidth-thin,max(1px,.0625rem)) var(--borderColor-default,var(--color-border-default));padding-top:var(--stack-padding-normal,1rem)}.Overlay-footer.Overlay-footer--alignStart{gap:var(--stack-gap-condensed,.5rem);justify-content:flex-start}.Overlay-footer.Overlay-footer--alignCenter{gap:var(--stack-gap-condensed,.5rem);justify-content:center}.Overlay-footer.Overlay-footer--alignEnd{gap:var(--stack-gap-condensed,.5rem);justify-content:flex-end}.Overlay-closeButton{align-self:flex-start;background-color:initial;border:var(--borderWidth-thin,max(1px,.0625rem)) solid #0000;border-radius:var(--borderRadius-medium,.375rem);color:var(--fgColor-muted,var(--color-fg-muted));cursor:pointer;display:grid;flex-shrink:0;height:var(--base-size-32,2rem);padding:0;place-content:center;position:relative;transition:.2s cubic-bezier(.3,0,.5,1);transition-property:color,background-color,border-color;-webkit-user-select:none;user-select:none;width:var(--base-size-32,2rem)}.Overlay-closeButton:focus,.Overlay-closeButton:hover{background-color:var(--button-default-bgColor-hover,var(--color-btn-hover-bg));border:var(--borderWidth-thin,max(1px,.0625rem)) solid var(--control-bgColor-hover,var(--color-btn-hover-bg))}.Overlay-closeButton.close-button{border:var(--borderWidth-thin,max(1px,.0625rem)) solid #0000}.Overlay--full{border-radius:unset!important;flex-grow:1;height:100%;max-height:100vh;max-width:100vw;width:100%}@media (max-width:767px){.Overlay--placement-right-whenNarrow,.Overlay.Overlay--placement-left-whenNarrow{height:100%;max-height:100vh;position:fixed}.Overlay.Overlay--placement-left-whenNarrow{animation-name:Overlay--motion-slideInLeft;border-bottom-left-radius:0;border-top-left-radius:0;inset:0 auto 0 0}.Overlay.Overlay--placement-right-whenNarrow{animation-name:Overlay--motion-slideInLeft;border-bottom-right-radius:0;border-top-right-radius:0;inset:0 0 0 auto}.Overlay.Overlay--placement-bottom-whenNarrow{animation-name:Overlay--motion-slideUp;border-bottom-left-radius:0;border-bottom-right-radius:0;inset:auto 0 0;max-width:100vw;width:100%}.Overlay--full-whenNarrow{border-radius:unset!important;flex-grow:1;height:100%;max-height:100vh;max-width:100vw;width:100%}}@keyframes Overlay--motion-slideDown{0%{transform:translateY(-100%)}}@keyframes Overlay--motion-slideUp{0%{transform:translateY(100%)}}@keyframes Overlay--motion-slideInRight{0%{transform:translateX(-100%)}}@keyframes Overlay--motion-slideInLeft{0%{transform:translateX(100%)}}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "alpha/dialog",
|
3
3
|
"selectors": [
|
4
|
+
"dialog.Overlay:not([open])",
|
4
5
|
".Overlay--hidden",
|
5
6
|
".Overlay--visibilityHidden",
|
6
7
|
".Overlay",
|
@@ -14,6 +15,9 @@
|
|
14
15
|
".Overlay.Overlay--size-large",
|
15
16
|
".Overlay.Overlay--size-xlarge",
|
16
17
|
".Overlay.Overlay--height-auto",
|
18
|
+
".Overlay.Overlay--placement-left",
|
19
|
+
".Overlay.Overlay--placement-right",
|
20
|
+
".Overlay.Overlay--motion-scaleFade",
|
17
21
|
".Overlay.Overlay--height-xsmall",
|
18
22
|
".Overlay.Overlay--height-small",
|
19
23
|
".Overlay.Overlay--height-medium",
|
@@ -25,7 +29,6 @@
|
|
25
29
|
".Overlay.Overlay--width-large",
|
26
30
|
".Overlay.Overlay--width-xlarge",
|
27
31
|
".Overlay.Overlay--width-xxlarge",
|
28
|
-
".Overlay.Overlay--motion-scaleFade",
|
29
32
|
".Overlay-form",
|
30
33
|
".Overlay-header",
|
31
34
|
".Overlay-header.Overlay-header--divided",
|
@@ -50,31 +53,11 @@
|
|
50
53
|
".Overlay-closeButton:focus",
|
51
54
|
".Overlay-closeButton:hover",
|
52
55
|
".Overlay-closeButton.close-button",
|
53
|
-
".Overlay
|
54
|
-
".Overlay-
|
55
|
-
".Overlay-
|
56
|
-
".Overlay
|
57
|
-
".Overlay
|
58
|
-
".Overlay
|
59
|
-
".Overlay-backdrop--side.Overlay-backdrop--placement-right>.Overlay",
|
60
|
-
".Overlay-backdrop--side.Overlay-backdrop--placement-bottom",
|
61
|
-
".Overlay-backdrop--side.Overlay-backdrop--placement-bottom>.Overlay",
|
62
|
-
".Overlay-backdrop--side.Overlay-backdrop--placement-top",
|
63
|
-
".Overlay-backdrop--side.Overlay-backdrop--placement-top>.Overlay",
|
64
|
-
".Overlay-backdrop--full",
|
65
|
-
".Overlay-backdrop--full .Overlay",
|
66
|
-
".Overlay-backdrop--center-whenNarrow",
|
67
|
-
".Overlay-backdrop--anchor-whenNarrow",
|
68
|
-
".Overlay-backdrop--side-whenNarrow",
|
69
|
-
".Overlay-backdrop--side-whenNarrow.Overlay-backdrop--placement-left-whenNarrow",
|
70
|
-
".Overlay-backdrop--side-whenNarrow.Overlay-backdrop--placement-left-whenNarrow>.Overlay-whenNarrow",
|
71
|
-
".Overlay-backdrop--side-whenNarrow.Overlay-backdrop--placement-right-whenNarrow",
|
72
|
-
".Overlay-backdrop--side-whenNarrow.Overlay-backdrop--placement-right-whenNarrow>.Overlay-whenNarrow",
|
73
|
-
".Overlay-backdrop--side-whenNarrow.Overlay-backdrop--placement-bottom-whenNarrow",
|
74
|
-
".Overlay-backdrop--side-whenNarrow.Overlay-backdrop--placement-bottom-whenNarrow>.Overlay-whenNarrow",
|
75
|
-
".Overlay-backdrop--side-whenNarrow.Overlay-backdrop--placement-top-whenNarrow",
|
76
|
-
".Overlay-backdrop--side-whenNarrow.Overlay-backdrop--placement-top-whenNarrow>.Overlay-whenNarrow",
|
77
|
-
".Overlay-backdrop--full-whenNarrow",
|
78
|
-
".Overlay-backdrop--full-whenNarrow .Overlay"
|
56
|
+
".Overlay--full",
|
57
|
+
".Overlay--placement-right-whenNarrow",
|
58
|
+
".Overlay.Overlay--placement-left-whenNarrow",
|
59
|
+
".Overlay.Overlay--placement-right-whenNarrow",
|
60
|
+
".Overlay.Overlay--placement-bottom-whenNarrow",
|
61
|
+
".Overlay--full-whenNarrow"
|
79
62
|
]
|
80
63
|
}
|
@@ -1 +1 @@
|
|
1
|
-
anchored-position[popover]{border-width:0;min-width:192px;overflow:visible;padding:0;position:absolute}anchored-position:not(.Overlay){background:none}.Overlay[popover]:not(:popover-open){display:none}anchored-position.not-anchored::backdrop{background-color:var(--overlay-backdrop-bgColor,var(--color-neutral-muted))}@media (forced-colors:active){.Overlay{outline:1px solid #0000}}
|
1
|
+
anchored-position[popover]{border-width:0;min-width:192px;overflow:visible;padding:0;position:absolute}anchored-position:not(.Overlay){background:none}.Overlay[popover]:not(:popover-open){display:none}anchored-position.not-anchored::backdrop,dialog::backdrop{background-color:var(--overlay-backdrop-bgColor,var(--color-neutral-muted))}@media (forced-colors:active){.Overlay{outline:1px solid #0000}}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
export declare class DialogHelperElement extends HTMLElement {
|
2
|
+
#private;
|
3
|
+
get dialog(): HTMLDialogElement | null;
|
4
|
+
connectedCallback(): void;
|
5
|
+
disconnectedCallback(): void;
|
6
|
+
handleEvent(event: MouseEvent): void;
|
7
|
+
}
|
8
|
+
declare global {
|
9
|
+
interface Window {
|
10
|
+
DialogHelperElement: typeof DialogHelperElement;
|
11
|
+
}
|
12
|
+
interface HTMLElementTagNameMap {
|
13
|
+
'dialog-helper': DialogHelperElement;
|
14
|
+
}
|
15
|
+
}
|
@@ -0,0 +1,77 @@
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
6
|
+
};
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
11
|
+
};
|
12
|
+
var _DialogHelperElement_abortController;
|
13
|
+
function dialogInvokerButtonHandler(event) {
|
14
|
+
const target = event.target;
|
15
|
+
const button = target === null || target === void 0 ? void 0 : target.closest('button');
|
16
|
+
if (!button || button.hasAttribute('disabled') || button.getAttribute('aria-disabled') === 'true')
|
17
|
+
return;
|
18
|
+
// If the user is clicking a valid dialog trigger
|
19
|
+
let dialogId = button === null || button === void 0 ? void 0 : button.getAttribute('data-show-dialog-id');
|
20
|
+
if (dialogId) {
|
21
|
+
event.stopPropagation();
|
22
|
+
const dialog = document.getElementById(dialogId);
|
23
|
+
if (dialog instanceof HTMLDialogElement) {
|
24
|
+
dialog.showModal();
|
25
|
+
// A buttons default behaviour in some browsers it to send a pointer event
|
26
|
+
// If the behaviour is allowed through the dialog will be shown but then
|
27
|
+
// quickly hidden- as if it were never shown. This prevents that.
|
28
|
+
event.preventDefault();
|
29
|
+
}
|
30
|
+
}
|
31
|
+
dialogId = button.getAttribute('data-close-dialog-id') || button.getAttribute('data-submit-dialog-id');
|
32
|
+
if (dialogId) {
|
33
|
+
const dialog = document.getElementById(dialogId);
|
34
|
+
if (dialog instanceof HTMLDialogElement && dialog.open) {
|
35
|
+
dialog.close();
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
export class DialogHelperElement extends HTMLElement {
|
40
|
+
constructor() {
|
41
|
+
super(...arguments);
|
42
|
+
_DialogHelperElement_abortController.set(this, null);
|
43
|
+
}
|
44
|
+
get dialog() {
|
45
|
+
return this.querySelector('dialog');
|
46
|
+
}
|
47
|
+
connectedCallback() {
|
48
|
+
const { signal } = (__classPrivateFieldSet(this, _DialogHelperElement_abortController, new AbortController(), "f"));
|
49
|
+
document.addEventListener('click', dialogInvokerButtonHandler);
|
50
|
+
document.addEventListener('click', this, { signal });
|
51
|
+
}
|
52
|
+
disconnectedCallback() {
|
53
|
+
var _a;
|
54
|
+
(_a = __classPrivateFieldGet(this, _DialogHelperElement_abortController, "f")) === null || _a === void 0 ? void 0 : _a.abort();
|
55
|
+
}
|
56
|
+
handleEvent(event) {
|
57
|
+
const target = event.target;
|
58
|
+
const dialog = this.dialog;
|
59
|
+
if (!(dialog === null || dialog === void 0 ? void 0 : dialog.open))
|
60
|
+
return;
|
61
|
+
if ((target === null || target === void 0 ? void 0 : target.closest('dialog')) !== dialog)
|
62
|
+
return;
|
63
|
+
const rect = dialog.getBoundingClientRect();
|
64
|
+
const clickWasInsideDialog = rect.top <= event.clientY &&
|
65
|
+
event.clientY <= rect.top + rect.height &&
|
66
|
+
rect.left <= event.clientX &&
|
67
|
+
event.clientX <= rect.left + rect.width;
|
68
|
+
if (!clickWasInsideDialog) {
|
69
|
+
dialog.close();
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
_DialogHelperElement_abortController = new WeakMap();
|
74
|
+
if (!window.customElements.get('dialog-helper')) {
|
75
|
+
window.DialogHelperElement = DialogHelperElement;
|
76
|
+
window.customElements.define('dialog-helper', DialogHelperElement);
|
77
|
+
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@primer/view-components",
|
3
|
-
"version": "0.17.0-rc.
|
3
|
+
"version": "0.17.0-rc.b11263cc",
|
4
4
|
"description": "ViewComponents for the Primer Design System",
|
5
5
|
"main": "app/assets/javascripts/primer_view_components.js",
|
6
6
|
"module": "app/components/primer/primer.js",
|
package/static/classes.json
CHANGED
@@ -372,34 +372,19 @@
|
|
372
372
|
"Primer::Alpha::Dialog",
|
373
373
|
"Primer::Alpha::Overlay"
|
374
374
|
],
|
375
|
-
"Overlay--
|
376
|
-
"Primer::Alpha::Dialog"
|
377
|
-
],
|
378
|
-
"Overlay--visibilityHidden": [
|
379
|
-
"Primer::Alpha::Dialog"
|
380
|
-
],
|
381
|
-
"Overlay-backdrop--anchor": [
|
382
|
-
"Primer::Alpha::Dialog"
|
383
|
-
],
|
384
|
-
"Overlay-backdrop--anchor-whenNarrow": [
|
385
|
-
"Primer::Alpha::Dialog"
|
386
|
-
],
|
387
|
-
"Overlay-backdrop--center": [
|
375
|
+
"Overlay--full": [
|
388
376
|
"Primer::Alpha::Dialog"
|
389
377
|
],
|
390
|
-
"Overlay
|
378
|
+
"Overlay--full-whenNarrow": [
|
391
379
|
"Primer::Alpha::Dialog"
|
392
380
|
],
|
393
|
-
"Overlay
|
394
|
-
"Primer::Alpha::Dialog"
|
395
|
-
],
|
396
|
-
"Overlay-backdrop--full-whenNarrow": [
|
381
|
+
"Overlay--hidden": [
|
397
382
|
"Primer::Alpha::Dialog"
|
398
383
|
],
|
399
|
-
"Overlay-
|
384
|
+
"Overlay--placement-right-whenNarrow": [
|
400
385
|
"Primer::Alpha::Dialog"
|
401
386
|
],
|
402
|
-
"Overlay
|
387
|
+
"Overlay--visibilityHidden": [
|
403
388
|
"Primer::Alpha::Dialog"
|
404
389
|
],
|
405
390
|
"Overlay-body": [
|
package/static/constants.json
CHANGED
@@ -228,16 +228,16 @@
|
|
228
228
|
"Footer": "Primer::Alpha::Dialog::Footer",
|
229
229
|
"Header": "Primer::Alpha::Dialog::Header",
|
230
230
|
"POSITION_MAPPINGS": {
|
231
|
-
"center": "
|
232
|
-
"left": "Overlay
|
233
|
-
"right": "Overlay
|
231
|
+
"center": "",
|
232
|
+
"left": "Overlay--placement-left",
|
233
|
+
"right": "Overlay--placement-right"
|
234
234
|
},
|
235
235
|
"POSITION_NARROW_MAPPINGS": {
|
236
236
|
"inherit": "",
|
237
|
-
"bottom": "Overlay
|
238
|
-
"fullscreen": "Overlay
|
239
|
-
"left": "Overlay
|
240
|
-
"right": "Overlay
|
237
|
+
"bottom": "Overlay--placement-bottom-whenNarrow",
|
238
|
+
"fullscreen": "Overlay--full-whenNarrow",
|
239
|
+
"left": "Overlay--placement-left-whenNarrow",
|
240
|
+
"right": "Overlay--placement-right-whenNarrow"
|
241
241
|
},
|
242
242
|
"POSITION_NARROW_OPTIONS": [
|
243
243
|
"inherit",
|