@wistia/ui 0.8.24 → 0.8.25

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/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  /*
3
- * @license @wistia/ui v0.8.24
3
+ * @license @wistia/ui v0.8.25
4
4
  *
5
5
  * Copyright (c) 2024-2025, Wistia, Inc. and its affiliates.
6
6
  *
@@ -10978,6 +10978,36 @@ var useFocusRestore = () => {
10978
10978
 
10979
10979
  // src/components/Modal/ModalContent.tsx
10980
10980
  var import_jsx_runtime243 = require("react/jsx-runtime");
10981
+ var alignTopStyles = import_styled_components64.css`
10982
+ --wui-modal-translate-y: 0;
10983
+
10984
+ top: 0;
10985
+ `;
10986
+ var alignVerticalCenterStyles = import_styled_components64.css`
10987
+ --wui-modal-translate-y: -50%;
10988
+
10989
+ top: 50%;
10990
+ `;
10991
+ var alignBottomStyles = import_styled_components64.css`
10992
+ --wui-modal-translate-y: 0;
10993
+
10994
+ bottom: 0;
10995
+ `;
10996
+ var alignHorizontalCenterStyles = import_styled_components64.css`
10997
+ --wui-modal-translate-x: -50%;
10998
+
10999
+ left: 50%;
11000
+ `;
11001
+ var alignRightStyles = import_styled_components64.css`
11002
+ --wui-modal-translate-x: 0;
11003
+
11004
+ right: 0;
11005
+ `;
11006
+ var alignLeftStyles = import_styled_components64.css`
11007
+ --wui-modal-translate-x: 0;
11008
+
11009
+ left: 0;
11010
+ `;
10981
11011
  var StyledModalContent = (0, import_styled_components64.default)(import_react_dialog3.Content)`
10982
11012
  background-color: var(--wui-color-bg-app);
10983
11013
  box-sizing: border-box;
@@ -10993,39 +11023,48 @@ var StyledModalContent = (0, import_styled_components64.default)(import_react_di
10993
11023
  z-index: var(--wui-zindex-modal);
10994
11024
 
10995
11025
  ${mq.smAndUp} {
10996
- animation: contentShow 150ms cubic-bezier(0.16, 1, 0.3, 1);
11026
+ --wui-modal-screen-offset: var(--wui-space-05);
11027
+ --wui-modal-max-height: calc(100vh - var(--wui-modal-screen-offset) * 2);
11028
+ --wui-modal-max-width: calc(100vw - var(--wui-modal-screen-offset) * 2);
11029
+
11030
+ top: unset;
11031
+ left: unset;
11032
+ ${({ $alignVertical }) => $alignVertical === "top" && alignTopStyles}
11033
+ ${({ $alignVertical }) => $alignVertical === "center" && alignVerticalCenterStyles}
11034
+ ${({ $alignVertical }) => $alignVertical === "bottom" && alignBottomStyles}
11035
+ ${({ $alignHorizontal }) => $alignHorizontal === "center" && alignHorizontalCenterStyles}
11036
+ ${({ $alignHorizontal }) => $alignHorizontal === "right" && alignRightStyles}
11037
+ ${({ $alignHorizontal }) => $alignHorizontal === "left" && alignLeftStyles}
11038
+ animation: contentShow var(--wui-motion-duration-03) var(--wui-motion-ease-out);
10997
11039
  border-radius: var(--wui-border-radius-03);
10998
- left: 50%;
10999
- margin: var(--wui-space-02);
11000
11040
  height: ${({ $fullHeight }) => $fullHeight ? "min-content" : "auto"};
11001
- max-height: 90vh;
11041
+ max-height: var(--wui-modal-max-height);
11002
11042
  ${({ $fullHeight }) => $fullHeight ? "min-height: calc(100vh - 48px);" : ""}
11003
- max-width: 90vw;
11004
- top: 50%;
11005
- transform: translate(-50%, -50%);
11043
+ max-width: var(--wui-modal-max-width);
11044
+ translate: var(--wui-modal-translate-x) var(--wui-modal-translate-y);
11006
11045
  min-width: ${({ $width }) => $width ?? DEFAULT_MODAL_WIDTH};
11007
11046
  width: ${({ $width }) => $width ?? DEFAULT_MODAL_WIDTH};
11008
11047
  }
11009
11048
 
11010
11049
  @keyframes contentShow {
11011
11050
  from {
11012
- opacity: 0;
11013
- transform: translate(-50%, -48%) scale(0.96);
11051
+ scale: 0.96;
11014
11052
  }
11015
11053
 
11016
11054
  to {
11017
- opacity: 1;
11018
- transform: translate(-50%, -50%) scale(1);
11055
+ scale: 1;
11019
11056
  }
11020
11057
  }
11021
11058
  `;
11022
11059
  var ModalContent = (0, import_react52.forwardRef)(
11023
- ({ fullHeight, width, children, ...props }, ref) => {
11060
+ ({ fullHeight, width, alignHorizontal, alignVertical, children, ...props }, ref) => {
11024
11061
  useFocusRestore();
11025
11062
  return /* @__PURE__ */ (0, import_jsx_runtime243.jsx)(
11026
11063
  StyledModalContent,
11027
11064
  {
11028
11065
  ref,
11066
+ $alignHorizontal: alignHorizontal,
11067
+ $alignVertical: alignVertical,
11029
11068
  $fullHeight: fullHeight,
11030
11069
  $width: width,
11031
11070
  "aria-describedby": void 0,
@@ -11040,7 +11079,6 @@ var ModalContent = (0, import_react52.forwardRef)(
11040
11079
  var import_react53 = require("react");
11041
11080
  var import_styled_components65 = __toESM(require("styled-components"));
11042
11081
  var import_jsx_runtime244 = require("react/jsx-runtime");
11043
- var backdropAnimationDuration = 150;
11044
11082
  var alignVerticalMap = {
11045
11083
  stretch: "normal",
11046
11084
  top: "start",
@@ -11054,9 +11092,7 @@ var alignHorizontalMap = {
11054
11092
  };
11055
11093
  var BackdropComponent = import_styled_components65.default.div`
11056
11094
  align-items: ${({ $alignVertical }) => alignVerticalMap[$alignVertical]};
11057
- animation-name: backdropShow;
11058
- animation-duration: ${() => `${backdropAnimationDuration}ms`};
11059
- animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
11095
+ animation-name: backdropShow var(--wui-motion-duration-03) var(--wui-motion-ease-out);
11060
11096
  background: var(--wui-color-backdrop);
11061
11097
  display: flex;
11062
11098
  inset: 0;
@@ -11100,6 +11136,7 @@ var DEFAULT_MODAL_WIDTH = "532px";
11100
11136
  var ModalBody = import_styled_components66.default.div`
11101
11137
  flex-direction: column;
11102
11138
  display: flex;
11139
+ flex: 1 0 0;
11103
11140
  order: 2;
11104
11141
  `;
11105
11142
  var Modal = (0, import_react54.forwardRef)(
@@ -11113,6 +11150,8 @@ var Modal = (0, import_react54.forwardRef)(
11113
11150
  onRequestClose,
11114
11151
  title,
11115
11152
  width = DEFAULT_MODAL_WIDTH,
11153
+ alignHorizontal = "center",
11154
+ alignVertical = "center",
11116
11155
  ...props
11117
11156
  }, ref) => {
11118
11157
  return /* @__PURE__ */ (0, import_jsx_runtime245.jsx)(
@@ -11130,6 +11169,8 @@ var Modal = (0, import_react54.forwardRef)(
11130
11169
  ModalContent,
11131
11170
  {
11132
11171
  ref,
11172
+ alignHorizontal,
11173
+ alignVertical,
11133
11174
  fullHeight,
11134
11175
  onOpenAutoFocus: (event) => {
11135
11176
  if ((0, import_type_guards42.isNotNil)(initialFocusRef) && initialFocusRef.current) {