@activecollab/components 2.0.439 → 2.0.441

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.
Files changed (51) hide show
  1. package/dist/cjs/components/Dialog/Dialog.js +8 -1
  2. package/dist/cjs/components/Dialog/Dialog.js.map +1 -1
  3. package/dist/cjs/components/Menu/Menu.js +45 -19
  4. package/dist/cjs/components/Menu/Menu.js.map +1 -1
  5. package/dist/cjs/components/Modal/Modal.js +16 -4
  6. package/dist/cjs/components/Modal/Modal.js.map +1 -1
  7. package/dist/cjs/components/Transitions/Fade/Fade.js +3 -2
  8. package/dist/cjs/components/Transitions/Fade/Fade.js.map +1 -1
  9. package/dist/cjs/components/Transitions/Grow/Grow.js +110 -0
  10. package/dist/cjs/components/Transitions/Grow/Grow.js.map +1 -0
  11. package/dist/cjs/components/Transitions/Grow/index.js +17 -0
  12. package/dist/cjs/components/Transitions/Grow/index.js.map +1 -0
  13. package/dist/cjs/components/Transitions/SlideFromTop/SlideFromTop.js +7 -5
  14. package/dist/cjs/components/Transitions/SlideFromTop/SlideFromTop.js.map +1 -1
  15. package/dist/cjs/components/Transitions/index.js +11 -0
  16. package/dist/cjs/components/Transitions/index.js.map +1 -1
  17. package/dist/esm/components/Dialog/Dialog.d.ts.map +1 -1
  18. package/dist/esm/components/Dialog/Dialog.js +10 -3
  19. package/dist/esm/components/Dialog/Dialog.js.map +1 -1
  20. package/dist/esm/components/Menu/Menu.d.ts.map +1 -1
  21. package/dist/esm/components/Menu/Menu.js +43 -19
  22. package/dist/esm/components/Menu/Menu.js.map +1 -1
  23. package/dist/esm/components/Modal/Modal.d.ts +5 -0
  24. package/dist/esm/components/Modal/Modal.d.ts.map +1 -1
  25. package/dist/esm/components/Modal/Modal.js +16 -4
  26. package/dist/esm/components/Modal/Modal.js.map +1 -1
  27. package/dist/esm/components/Transitions/Fade/Fade.d.ts +1 -0
  28. package/dist/esm/components/Transitions/Fade/Fade.d.ts.map +1 -1
  29. package/dist/esm/components/Transitions/Fade/Fade.js +2 -1
  30. package/dist/esm/components/Transitions/Fade/Fade.js.map +1 -1
  31. package/dist/esm/components/Transitions/Grow/Grow.d.ts +14 -0
  32. package/dist/esm/components/Transitions/Grow/Grow.d.ts.map +1 -0
  33. package/dist/esm/components/Transitions/Grow/Grow.js +88 -0
  34. package/dist/esm/components/Transitions/Grow/Grow.js.map +1 -0
  35. package/dist/esm/components/Transitions/Grow/index.d.ts +2 -0
  36. package/dist/esm/components/Transitions/Grow/index.d.ts.map +1 -0
  37. package/dist/esm/components/Transitions/Grow/index.js +2 -0
  38. package/dist/esm/components/Transitions/Grow/index.js.map +1 -0
  39. package/dist/esm/components/Transitions/SlideFromTop/SlideFromTop.d.ts +2 -0
  40. package/dist/esm/components/Transitions/SlideFromTop/SlideFromTop.d.ts.map +1 -1
  41. package/dist/esm/components/Transitions/SlideFromTop/SlideFromTop.js +6 -4
  42. package/dist/esm/components/Transitions/SlideFromTop/SlideFromTop.js.map +1 -1
  43. package/dist/esm/components/Transitions/index.d.ts +1 -0
  44. package/dist/esm/components/Transitions/index.d.ts.map +1 -1
  45. package/dist/esm/components/Transitions/index.js +1 -0
  46. package/dist/esm/components/Transitions/index.js.map +1 -1
  47. package/dist/index.js +917 -775
  48. package/dist/index.js.map +1 -1
  49. package/dist/index.min.js +1 -1
  50. package/dist/index.min.js.map +1 -1
  51. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -14815,6 +14815,467 @@
14815
14815
  });
14816
14816
  Popper.displayName = "Popper";
14817
14817
 
14818
+ var _excluded$1E = ["in", "children", "style", "timeout", "onEnter"];
14819
+ var FADE_DURATION = 500;
14820
+ var defaultStyle$2 = function defaultStyle(duration) {
14821
+ return {
14822
+ transition: "all ".concat(duration, "ms ease-in-out"),
14823
+ opacity: 0
14824
+ };
14825
+ };
14826
+ var transitionStyles$3 = {
14827
+ entering: {
14828
+ opacity: 1
14829
+ },
14830
+ entered: {
14831
+ opacity: 1
14832
+ },
14833
+ exiting: {
14834
+ opacity: 0
14835
+ },
14836
+ exited: {
14837
+ opacity: 0
14838
+ }
14839
+ };
14840
+ var Fade = function Fade(_ref) {
14841
+ var _ref$in = _ref.in,
14842
+ inProp = _ref$in === void 0 ? false : _ref$in,
14843
+ children = _ref.children,
14844
+ style = _ref.style,
14845
+ _ref$timeout = _ref.timeout,
14846
+ timeout = _ref$timeout === void 0 ? FADE_DURATION : _ref$timeout,
14847
+ onEnter = _ref.onEnter,
14848
+ rest = _objectWithoutProperties(_ref, _excluded$1E);
14849
+ // Same forced layout as SlideFromTop: without it the starting opacity never lands in the DOM.
14850
+ var handleEnter = function handleEnter(node, isAppearing) {
14851
+ if (node) {
14852
+ void node.offsetHeight;
14853
+ }
14854
+ onEnter === null || onEnter === void 0 || onEnter(node, isAppearing);
14855
+ };
14856
+ return /*#__PURE__*/React__default["default"].createElement(reactTransitionGroup.Transition, _extends({
14857
+ appear: true,
14858
+ in: inProp,
14859
+ timeout: timeout,
14860
+ onEnter: handleEnter
14861
+ }, rest), function (state) {
14862
+ return /*#__PURE__*/React.cloneElement(children, {
14863
+ style: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
14864
+ visibility: state === "exited" && !inProp ? "hidden" : undefined
14865
+ }, defaultStyle$2(timeout)), transitionStyles$3[state]), style), children.props.style)
14866
+ });
14867
+ });
14868
+ };
14869
+ Fade.displayName = "Fade";
14870
+
14871
+ var _excluded$1D = ["in", "children", "style", "timeout", "initialDirection"];
14872
+ var Slide = function Slide(_ref) {
14873
+ var _ref$in = _ref.in,
14874
+ inProp = _ref$in === void 0 ? false : _ref$in,
14875
+ children = _ref.children,
14876
+ style = _ref.style,
14877
+ _ref$timeout = _ref.timeout,
14878
+ timeout = _ref$timeout === void 0 ? 300 : _ref$timeout,
14879
+ _ref$initialDirection = _ref.initialDirection,
14880
+ initialDirection = _ref$initialDirection === void 0 ? "left" : _ref$initialDirection,
14881
+ rest = _objectWithoutProperties(_ref, _excluded$1D);
14882
+ var directionSign;
14883
+ switch (initialDirection) {
14884
+ case "right":
14885
+ directionSign = "100%, 0";
14886
+ break;
14887
+ case "top":
14888
+ directionSign = "0, -100%";
14889
+ break;
14890
+ case "bottom":
14891
+ directionSign = "0, 100%";
14892
+ break;
14893
+ default:
14894
+ directionSign = "-100%, 0";
14895
+ }
14896
+ var defaultStyle = function defaultStyle(timeout) {
14897
+ return {
14898
+ transition: "all ".concat(timeout, "ms ease")
14899
+ };
14900
+ };
14901
+ var transitionStyles = {
14902
+ entering: {
14903
+ transform: "translate(0,0)"
14904
+ },
14905
+ entered: {
14906
+ transform: "translate(0,0)"
14907
+ },
14908
+ exiting: {
14909
+ transform: "translate(".concat(directionSign, ")")
14910
+ },
14911
+ exited: {
14912
+ transform: "translate(".concat(directionSign, ")")
14913
+ }
14914
+ };
14915
+ return /*#__PURE__*/React__default["default"].createElement(reactTransitionGroup.Transition, _extends({
14916
+ in: inProp,
14917
+ timeout: timeout
14918
+ }, rest), function (state) {
14919
+ return /*#__PURE__*/React.cloneElement(children, {
14920
+ style: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
14921
+ visibility: state === "exited" && !inProp ? "hidden" : undefined
14922
+ }, defaultStyle(timeout)), transitionStyles[state]), style), children.props.style)
14923
+ });
14924
+ });
14925
+ };
14926
+ Slide.displayName = "Slide";
14927
+
14928
+ var defaultStyle$1 = {
14929
+ transitionProperty: "opacity, transform",
14930
+ transitionDuration: ".15s, .10s, .15s",
14931
+ transitionTimingFunction: "ease, ease, cubic-bezier(0.39, 0.575, 0.565, 1)",
14932
+ transformOrigin: "50% 0",
14933
+ transform: "scale(.85)",
14934
+ opacity: 0
14935
+ };
14936
+ var transitionStyles$2 = {
14937
+ entering: {
14938
+ opacity: 1,
14939
+ transform: "scale(1)",
14940
+ transitionDelay: ".6s"
14941
+ },
14942
+ entered: {
14943
+ opacity: 1,
14944
+ transform: "scale(1)"
14945
+ },
14946
+ exiting: {
14947
+ opacity: 0,
14948
+ transform: "scale(.85)"
14949
+ },
14950
+ exited: {
14951
+ opacity: 0,
14952
+ transform: "scale(.85)"
14953
+ }
14954
+ };
14955
+ var FromElement = function FromElement(_ref) {
14956
+ var _ref$in = _ref.in,
14957
+ inProp = _ref$in === void 0 ? false : _ref$in,
14958
+ onEnter = _ref.onEnter,
14959
+ onExited = _ref.onExited,
14960
+ children = _ref.children,
14961
+ style = _ref.style,
14962
+ _ref$timeout = _ref.timeout,
14963
+ timeout = _ref$timeout === void 0 ? 1000 : _ref$timeout;
14964
+ return /*#__PURE__*/React__default["default"].createElement(reactTransitionGroup.Transition, {
14965
+ appear: true,
14966
+ in: inProp,
14967
+ timeout: timeout,
14968
+ onEnter: onEnter,
14969
+ onExited: onExited
14970
+ }, function (state) {
14971
+ return /*#__PURE__*/React.cloneElement(children, {
14972
+ style: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
14973
+ visibility: state === "exited" && !inProp ? "hidden" : undefined
14974
+ }, defaultStyle$1), transitionStyles$2[state]), style), children.props.style)
14975
+ });
14976
+ });
14977
+ };
14978
+ FromElement.displayName = "FromElement";
14979
+
14980
+ var DEFAULT_DISTANCE = 25;
14981
+ var SLIDE_FROM_TOP_ENTER = 300;
14982
+ var SLIDE_FROM_TOP_EXIT = 200;
14983
+ var buildStyles$1 = function buildStyles(distance) {
14984
+ var away = "translateY(-".concat(distance, "px)");
14985
+ return {
14986
+ base: {
14987
+ transitionProperty: "opacity, transform",
14988
+ transitionTimingFunction: "ease-out",
14989
+ transform: away,
14990
+ opacity: 0
14991
+ },
14992
+ entering: {
14993
+ opacity: 1,
14994
+ transform: "translateY(0)",
14995
+ transitionDuration: "".concat(SLIDE_FROM_TOP_ENTER, "ms")
14996
+ },
14997
+ entered: {
14998
+ opacity: 1,
14999
+ transform: "translateY(0)",
15000
+ transitionDuration: "".concat(SLIDE_FROM_TOP_ENTER, "ms")
15001
+ },
15002
+ exiting: {
15003
+ opacity: 0,
15004
+ transform: away,
15005
+ transitionDuration: "".concat(SLIDE_FROM_TOP_EXIT, "ms")
15006
+ },
15007
+ exited: {
15008
+ opacity: 0,
15009
+ transform: away,
15010
+ transitionDuration: "".concat(SLIDE_FROM_TOP_EXIT, "ms")
15011
+ }
15012
+ };
15013
+ };
15014
+ var SlideFromTop = function SlideFromTop(_ref) {
15015
+ var _ref$in = _ref.in,
15016
+ inProp = _ref$in === void 0 ? false : _ref$in,
15017
+ onEnter = _ref.onEnter,
15018
+ onExited = _ref.onExited,
15019
+ children = _ref.children,
15020
+ style = _ref.style,
15021
+ _ref$timeout = _ref.timeout,
15022
+ timeout = _ref$timeout === void 0 ? 400 : _ref$timeout,
15023
+ _ref$distance = _ref.distance,
15024
+ distance = _ref$distance === void 0 ? DEFAULT_DISTANCE : _ref$distance;
15025
+ var styles = buildStyles$1(distance);
15026
+
15027
+ // React flushes the state change that follows onEnter before the browser paints, so without a
15028
+ // forced layout here the element never holds its starting style and the transition is skipped.
15029
+ var handleEnter = function handleEnter(node, isAppearing) {
15030
+ if (node) {
15031
+ void node.offsetHeight;
15032
+ }
15033
+ onEnter === null || onEnter === void 0 || onEnter(node, isAppearing);
15034
+ };
15035
+ return /*#__PURE__*/React__default["default"].createElement(reactTransitionGroup.Transition, {
15036
+ appear: true,
15037
+ in: inProp,
15038
+ timeout: timeout,
15039
+ onEnter: handleEnter,
15040
+ onExited: onExited
15041
+ }, function (state) {
15042
+ return /*#__PURE__*/React.cloneElement(children, {
15043
+ style: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
15044
+ visibility: state === "exited" && !inProp ? "hidden" : undefined
15045
+ }, styles.base), styles[state]), style), children.props.style)
15046
+ });
15047
+ });
15048
+ };
15049
+ SlideFromTop.displayName = "SlideFromTop";
15050
+
15051
+ var StyledSlideLeftRight = styled.createGlobalStyle(["", " ", ""], function (props) {
15052
+ return props.$direction === "left" && styled.css(["&.c-slide-enter{position:absolute;transform:translateX(100%);}&.c-slide-enter-active{transform:translateX(0%);transition:all 200ms ease;}&.c-slide-exit{position:absolute;}&.c-slide-exit-active{transform:translateX(-100%);transition:all 200ms ease;}"]);
15053
+ }, function (props) {
15054
+ return props.$direction === "right" && styled.css(["&.c-slide-enter{position:absolute;transform:translateX(-100%);}&.c-slide-enter-active{transform:translateX(0%);transition:all 200ms ease;}&.c-slide-exit{position:absolute;}&.c-slide-exit-active{transform:translateX(100%);transition:all 200ms ease;}"]);
15055
+ });
15056
+
15057
+ var _excluded$1C = ["children", "direction"];
15058
+ var SlideLeftRightTransition = function SlideLeftRightTransition(_ref) {
15059
+ var children = _ref.children,
15060
+ _ref$direction = _ref.direction,
15061
+ direction = _ref$direction === void 0 ? "left" : _ref$direction,
15062
+ props = _objectWithoutProperties(_ref, _excluded$1C);
15063
+ return /*#__PURE__*/React__default["default"].createElement(reactTransitionGroup.CSSTransition, _extends({
15064
+ timeout: 200,
15065
+ classNames: "c-slide",
15066
+ unmountOnExit: true
15067
+ }, props), /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, children, /*#__PURE__*/React__default["default"].createElement(StyledSlideLeftRight, {
15068
+ $direction: direction
15069
+ })));
15070
+ };
15071
+ SlideLeftRightTransition.displayName = "SlideLeftRightTransition";
15072
+
15073
+ var ResizeTransition = function ResizeTransition(_ref) {
15074
+ var _ref$in = _ref.in,
15075
+ inProp = _ref$in === void 0 ? false : _ref$in,
15076
+ onEnter = _ref.onEnter,
15077
+ onExited = _ref.onExited,
15078
+ children = _ref.children,
15079
+ style = _ref.style,
15080
+ _ref$timeout = _ref.timeout,
15081
+ timeout = _ref$timeout === void 0 ? 200 : _ref$timeout;
15082
+ var defaultStyle = React.useMemo(function () {
15083
+ return {
15084
+ transitionProperty: "width, height",
15085
+ transitionDuration: "".concat(timeout, "ms"),
15086
+ transitionTimingFunction: "ease"
15087
+ };
15088
+ }, [timeout]);
15089
+ return /*#__PURE__*/React__default["default"].createElement(reactTransitionGroup.Transition, {
15090
+ appear: true,
15091
+ in: inProp,
15092
+ timeout: timeout,
15093
+ onEnter: onEnter,
15094
+ onExited: onExited
15095
+ }, function (state) {
15096
+ return /*#__PURE__*/React.cloneElement(children, {
15097
+ style: _objectSpread2(_objectSpread2(_objectSpread2({
15098
+ visibility: state === "exited" && !inProp ? "hidden" : undefined
15099
+ }, defaultStyle), style), children.props.style)
15100
+ });
15101
+ });
15102
+ };
15103
+ ResizeTransition.displayName = "ResizeTransition";
15104
+
15105
+ var _excluded$1B = ["in", "children", "style", "timeout"];
15106
+ var defaultStyle = function defaultStyle(duration) {
15107
+ return {
15108
+ transition: "all ".concat(duration, "ms ease-in"),
15109
+ transform: "scaleX(0)",
15110
+ opacity: 0,
15111
+ transformOrigin: "left"
15112
+ };
15113
+ };
15114
+ var transitionStyles$1 = {
15115
+ entering: {
15116
+ transform: "scaleX(1)",
15117
+ opacity: 1
15118
+ },
15119
+ entered: {
15120
+ transform: "scaleX(1)",
15121
+ opacity: 1
15122
+ },
15123
+ exiting: {
15124
+ transform: "scaleX(0)",
15125
+ opacity: 0
15126
+ },
15127
+ exited: {
15128
+ transform: "scaleX(0)",
15129
+ opacity: 0
15130
+ }
15131
+ };
15132
+ var Reveal = function Reveal(_ref) {
15133
+ var _ref$in = _ref.in,
15134
+ inProp = _ref$in === void 0 ? false : _ref$in,
15135
+ children = _ref.children,
15136
+ style = _ref.style,
15137
+ _ref$timeout = _ref.timeout,
15138
+ timeout = _ref$timeout === void 0 ? 200 : _ref$timeout,
15139
+ rest = _objectWithoutProperties(_ref, _excluded$1B);
15140
+ return /*#__PURE__*/React__default["default"].createElement(reactTransitionGroup.Transition, _extends({
15141
+ appear: true,
15142
+ in: inProp,
15143
+ timeout: timeout
15144
+ }, rest), function (state) {
15145
+ return /*#__PURE__*/React.cloneElement(children, {
15146
+ style: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, defaultStyle(inProp ? timeout : 0)), transitionStyles$1[state]), style), children.props.style)
15147
+ });
15148
+ });
15149
+ };
15150
+ Reveal.displayName = "Reveal";
15151
+
15152
+ var transitionStyles = {
15153
+ entered: {
15154
+ transform: "scale(1)"
15155
+ },
15156
+ exiting: {
15157
+ transform: "scale(0)"
15158
+ }
15159
+ };
15160
+ var Scale = function Scale(_ref) {
15161
+ var _ref$in = _ref.in,
15162
+ inProp = _ref$in === void 0 ? false : _ref$in,
15163
+ onEnter = _ref.onEnter,
15164
+ onExited = _ref.onExited,
15165
+ children = _ref.children,
15166
+ style = _ref.style,
15167
+ _ref$timeout = _ref.timeout,
15168
+ timeout = _ref$timeout === void 0 ? 200 : _ref$timeout;
15169
+ var defaultStyle = React.useMemo(function () {
15170
+ return {
15171
+ transitionProperty: "transform",
15172
+ transitionDuration: "".concat(timeout, "ms"),
15173
+ transform: "scale(0)"
15174
+ };
15175
+ }, [timeout]);
15176
+ return /*#__PURE__*/React__default["default"].createElement(reactTransitionGroup.Transition, {
15177
+ in: inProp,
15178
+ timeout: timeout,
15179
+ onEnter: onEnter,
15180
+ onExited: onExited
15181
+ }, function (state) {
15182
+ return /*#__PURE__*/React.cloneElement(children, {
15183
+ style: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, defaultStyle), transitionStyles[state]), style), children.props.style)
15184
+ });
15185
+ });
15186
+ };
15187
+ Scale.displayName = "Scale";
15188
+
15189
+ var GROW_ENTER = 140;
15190
+ var GROW_EXIT = 100;
15191
+ var START_SCALE = 0.96;
15192
+
15193
+ // jsdom and SSR have no matchMedia, and a reader who asks for less motion gets none.
15194
+ var prefersReducedMotion = function prefersReducedMotion() {
15195
+ return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
15196
+ };
15197
+ var originFor = function originFor(placement) {
15198
+ var _split = (placement || "bottom-start").split("-"),
15199
+ _split2 = _slicedToArray(_split, 2),
15200
+ side = _split2[0],
15201
+ alignment = _split2[1];
15202
+ var vertical = side === "top" ? "bottom" : "top";
15203
+ var horizontal = alignment === "end" ? "right" : "left";
15204
+ if (side === "left" || side === "right") {
15205
+ return "center ".concat(side === "left" ? "right" : "left");
15206
+ }
15207
+ return "".concat(horizontal, " ").concat(vertical);
15208
+ };
15209
+ var buildStyles = function buildStyles(origin, enter, exit) {
15210
+ var away = "scale(".concat(START_SCALE, ")");
15211
+ return {
15212
+ base: {
15213
+ transformOrigin: origin,
15214
+ transitionProperty: "opacity, transform",
15215
+ transitionTimingFunction: "ease-out",
15216
+ transform: away,
15217
+ opacity: 0
15218
+ },
15219
+ entering: {
15220
+ opacity: 1,
15221
+ transform: "scale(1)",
15222
+ transitionDuration: "".concat(enter, "ms")
15223
+ },
15224
+ entered: {
15225
+ opacity: 1,
15226
+ transform: "scale(1)"
15227
+ },
15228
+ exiting: {
15229
+ opacity: 0,
15230
+ transform: away,
15231
+ transitionDuration: "".concat(exit, "ms")
15232
+ },
15233
+ exited: {
15234
+ opacity: 0,
15235
+ transform: away
15236
+ }
15237
+ };
15238
+ };
15239
+ var Grow = function Grow(_ref) {
15240
+ var _ref$in = _ref.in,
15241
+ inProp = _ref$in === void 0 ? false : _ref$in,
15242
+ onEnter = _ref.onEnter,
15243
+ onExited = _ref.onExited,
15244
+ children = _ref.children,
15245
+ style = _ref.style,
15246
+ placement = _ref.placement,
15247
+ _ref$timeout = _ref.timeout,
15248
+ timeout = _ref$timeout === void 0 ? GROW_ENTER : _ref$timeout;
15249
+ var still = prefersReducedMotion();
15250
+ var enter = still ? 0 : timeout;
15251
+ var exit = still ? 0 : GROW_EXIT;
15252
+ var styles = buildStyles(originFor(placement), enter, exit);
15253
+
15254
+ // React flushes the state change that follows onEnter before the browser paints, so without a
15255
+ // forced layout here the element never holds its starting style and the transition is skipped.
15256
+ var handleEnter = function handleEnter(node, isAppearing) {
15257
+ if (node) {
15258
+ void node.offsetHeight;
15259
+ }
15260
+ onEnter === null || onEnter === void 0 || onEnter(node, isAppearing);
15261
+ };
15262
+ return /*#__PURE__*/React__default["default"].createElement(reactTransitionGroup.Transition, {
15263
+ appear: true,
15264
+ in: inProp,
15265
+ timeout: {
15266
+ enter,
15267
+ exit
15268
+ },
15269
+ onEnter: handleEnter,
15270
+ onExited: onExited
15271
+ }, function (state) {
15272
+ return /*#__PURE__*/React.cloneElement(children, {
15273
+ style: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, styles.base), styles[state]), style), children.props.style)
15274
+ });
15275
+ });
15276
+ };
15277
+ Grow.displayName = "Grow";
15278
+
14818
15279
  var StyledWindow = styled__default["default"].div.withConfig({
14819
15280
  displayName: "Style__StyledWindow",
14820
15281
  componentId: "sc-rnlftg-0"
@@ -14847,7 +15308,7 @@
14847
15308
  };
14848
15309
  var LayerContext$1 = LayerContext;
14849
15310
 
14850
- var _excluded$1E = ["children", "onClose", "className", "style", "onKeyDown", "disableFocusLock", "disableScrollLock", "disableCloseOnEsc", "onClick"];
15311
+ var _excluded$1A = ["children", "onClose", "className", "style", "onKeyDown", "disableFocusLock", "disableScrollLock", "disableCloseOnEsc", "onClick"];
14851
15312
  var returnFocus = {
14852
15313
  preventScroll: true
14853
15314
  };
@@ -14864,7 +15325,7 @@
14864
15325
  _ref$disableCloseOnEs = _ref.disableCloseOnEsc,
14865
15326
  disableCloseOnEsc = _ref$disableCloseOnEs === void 0 ? false : _ref$disableCloseOnEs,
14866
15327
  onClick = _ref.onClick,
14867
- rest = _objectWithoutProperties(_ref, _excluded$1E);
15328
+ rest = _objectWithoutProperties(_ref, _excluded$1A);
14868
15329
  var innerRef = React.useRef(null);
14869
15330
  var handleRef = useForkRef(innerRef, ref);
14870
15331
  var _useLayerContext = useLayerContext(),
@@ -14937,15 +15398,24 @@
14937
15398
  _useState2 = _slicedToArray(_useState, 2),
14938
15399
  open = _useState2[0],
14939
15400
  setOpen = _useState2[1];
14940
- var _useState3 = React.useState(),
15401
+ var _useState3 = React.useState(!defaultOpen),
14941
15402
  _useState4 = _slicedToArray(_useState3, 2),
14942
- childNode = _useState4[0],
14943
- setChildNode = _useState4[1];
15403
+ exited = _useState4[0],
15404
+ setExited = _useState4[1];
15405
+ var _useState5 = React.useState(),
15406
+ _useState6 = _slicedToArray(_useState5, 2),
15407
+ childNode = _useState6[0],
15408
+ setChildNode = _useState6[1];
14944
15409
  var elementRef = React.useRef(null);
14945
15410
  var isOpenAtLeastOnce = React.useRef(false);
14946
15411
  React.useEffect(function () {
14947
15412
  setOpen(defaultOpen);
14948
15413
  }, [defaultOpen]);
15414
+ React.useEffect(function () {
15415
+ if (open) {
15416
+ setExited(false);
15417
+ }
15418
+ }, [open]);
14949
15419
  var handleRefRef = useForkRef(target ? target.ref : undefined, setChildNode);
14950
15420
  var handleRef = useForkRef(handleRefRef, elementRef);
14951
15421
  var handleOpen = React.useCallback(function (event) {
@@ -14980,35 +15450,51 @@
14980
15450
  isOpenAtLeastOnce.current = false;
14981
15451
  }
14982
15452
  }, [open]);
14983
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, target && /*#__PURE__*/React__default["default"].cloneElement(target, targetProps), open ? /*#__PURE__*/React__default["default"].createElement(Window, {
15453
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, target && /*#__PURE__*/React__default["default"].cloneElement(target, targetProps), open || !exited ? /*#__PURE__*/React__default["default"].createElement(Window, {
14984
15454
  onClose: handleClose,
14985
- disableScrollLock: !handleScroll,
14986
- disableFocusLock: disableFocusLock,
15455
+ disableScrollLock: !handleScroll
15456
+ // A closing menu hands the focus back at once, it does not hold it for the length of the fade.
15457
+ ,
15458
+ disableFocusLock: disableFocusLock || !open,
14987
15459
  style: {
14988
15460
  position: windowAbsolutelyPositioned ? "absolute" : "fixed"
14989
15461
  }
14990
- }, /*#__PURE__*/React__default["default"].createElement(Overlay, {
15462
+ }, open ? /*#__PURE__*/React__default["default"].createElement(Overlay, {
14991
15463
  className: backgroundElementClass,
14992
15464
  onClick: handleClose,
14993
15465
  tabIndex: -1,
14994
15466
  disableBackgroundColor: true
14995
- }), /*#__PURE__*/React__default["default"].createElement(Popper, {
15467
+ }) : null, /*#__PURE__*/React__default["default"].createElement(Popper, {
14996
15468
  anchorEl: childNode,
14997
15469
  open: childNode ? open : false,
14998
15470
  placement: position,
14999
15471
  className: popperClassName,
15000
15472
  tabIndex: -1,
15001
- afterWrite: onPopperOpen
15002
- }, /*#__PURE__*/React__default["default"].createElement(StyledMenu$3, {
15003
- className: classNames__default["default"]("c-simple-menu__paper", "c-simple-menu__".concat(mode), menuClassName, className),
15004
- $mode: mode,
15005
- onMouseDown: onMenuClick
15006
- }, /*#__PURE__*/React__default["default"].createElement(MenuContextProvider, {
15007
- value: {
15008
- open,
15009
- setOpen
15010
- }
15011
- }, typeof children === "function" ? children(childProps) : children)))) : null);
15473
+ afterWrite: onPopperOpen,
15474
+ transition: true
15475
+ }, function (_ref2) {
15476
+ var placement = _ref2.placement,
15477
+ transitionProps = _ref2.transitionProps;
15478
+ return /*#__PURE__*/React__default["default"].createElement(Grow, {
15479
+ placement: placement,
15480
+ in: transitionProps === null || transitionProps === void 0 ? void 0 : transitionProps.in,
15481
+ onEnter: transitionProps === null || transitionProps === void 0 ? void 0 : transitionProps.onEnter,
15482
+ onExited: function onExited() {
15483
+ var _transitionProps$onEx;
15484
+ setExited(true);
15485
+ transitionProps === null || transitionProps === void 0 || (_transitionProps$onEx = transitionProps.onExited) === null || _transitionProps$onEx === void 0 || _transitionProps$onEx.call(transitionProps);
15486
+ }
15487
+ }, /*#__PURE__*/React__default["default"].createElement(StyledMenu$3, {
15488
+ className: classNames__default["default"]("c-simple-menu__paper", "c-simple-menu__".concat(mode), menuClassName, className),
15489
+ $mode: mode,
15490
+ onMouseDown: onMenuClick
15491
+ }, /*#__PURE__*/React__default["default"].createElement(MenuContextProvider, {
15492
+ value: {
15493
+ open,
15494
+ setOpen
15495
+ }
15496
+ }, typeof children === "function" ? children(childProps) : children)));
15497
+ })) : null);
15012
15498
  };
15013
15499
  Menu.displayName = "Menu";
15014
15500
 
@@ -15176,7 +15662,7 @@
15176
15662
  });
15177
15663
  StyledTypography.displayName = "StyledTypography";
15178
15664
 
15179
- var _excluded$1D = ["variant", "as", "color", "italic", "tabularNums", "letterSpacing", "lineHeight", "align", "decoration", "transform", "overflow", "whitespace", "wordBreak", "weight", "className", "children"];
15665
+ var _excluded$1z = ["variant", "as", "color", "italic", "tabularNums", "letterSpacing", "lineHeight", "align", "decoration", "transform", "overflow", "whitespace", "wordBreak", "weight", "className", "children"];
15180
15666
  var Typography = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
15181
15667
  var _ref$variant = _ref.variant,
15182
15668
  variant = _ref$variant === void 0 ? "Title 1" : _ref$variant,
@@ -15207,7 +15693,7 @@
15207
15693
  weight = _ref$weight === void 0 ? "regular" : _ref$weight,
15208
15694
  className = _ref.className,
15209
15695
  children = _ref.children,
15210
- props = _objectWithoutProperties(_ref, _excluded$1D);
15696
+ props = _objectWithoutProperties(_ref, _excluded$1z);
15211
15697
  var Component = as || "div";
15212
15698
  return /*#__PURE__*/React__default["default"].createElement(StyledTypography, _extends({
15213
15699
  as: Component,
@@ -15230,13 +15716,13 @@
15230
15716
  });
15231
15717
  Typography.displayName = "Typography";
15232
15718
 
15233
- var _excluded$1C = ["title", "className", "leftElement", "rightElement"];
15719
+ var _excluded$1y = ["title", "className", "leftElement", "rightElement"];
15234
15720
  var MenuHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
15235
15721
  var title = _ref.title,
15236
15722
  className = _ref.className,
15237
15723
  leftElement = _ref.leftElement,
15238
15724
  rightElement = _ref.rightElement,
15239
- props = _objectWithoutProperties(_ref, _excluded$1C);
15725
+ props = _objectWithoutProperties(_ref, _excluded$1y);
15240
15726
  return /*#__PURE__*/React__default["default"].createElement(StyledMenuHeader, _extends({}, props, {
15241
15727
  className: classNames__default["default"]("c-menu-header", className),
15242
15728
  ref: ref
@@ -15261,11 +15747,11 @@
15261
15747
  });
15262
15748
  MenuHeader.displayName = "MenuHeader";
15263
15749
 
15264
- var _excluded$1B = ["children", "className"];
15750
+ var _excluded$1x = ["children", "className"];
15265
15751
  var MenuFooter = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
15266
15752
  var children = _ref.children,
15267
15753
  className = _ref.className,
15268
- props = _objectWithoutProperties(_ref, _excluded$1B);
15754
+ props = _objectWithoutProperties(_ref, _excluded$1x);
15269
15755
  return /*#__PURE__*/React__default["default"].createElement(StyledMenuFooter$1, _extends({}, props, {
15270
15756
  className: classNames__default["default"]("c-menu-footer", className),
15271
15757
  ref: ref
@@ -15273,14 +15759,14 @@
15273
15759
  });
15274
15760
  MenuFooter.displayName = "MenuFooter";
15275
15761
 
15276
- var _excluded$1A = ["children", "className", "separator"];
15762
+ var _excluded$1w = ["children", "className", "separator"];
15277
15763
  var Breadcrumbs = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
15278
15764
  var _dimensions$width, _childDimensions$widt;
15279
15765
  var children = _ref.children,
15280
15766
  className = _ref.className,
15281
15767
  _ref$separator = _ref.separator,
15282
15768
  separator = _ref$separator === void 0 ? "/" : _ref$separator,
15283
- rest = _objectWithoutProperties(_ref, _excluded$1A);
15769
+ rest = _objectWithoutProperties(_ref, _excluded$1w);
15284
15770
  var internalRef = React.useRef(null);
15285
15771
  var listWrapperRef = React.useRef(null);
15286
15772
  var olRef = React.useRef(null);
@@ -15509,12 +15995,12 @@
15509
15995
  }, label);
15510
15996
  };
15511
15997
 
15512
- var _excluded$1z = ["weight", "children"];
15998
+ var _excluded$1v = ["weight", "children"];
15513
15999
  var Body2 = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
15514
16000
  var _ref$weight = _ref.weight,
15515
16001
  weight = _ref$weight === void 0 ? "regular" : _ref$weight,
15516
16002
  children = _ref.children,
15517
- props = _objectWithoutProperties(_ref, _excluded$1z);
16003
+ props = _objectWithoutProperties(_ref, _excluded$1v);
15518
16004
  return /*#__PURE__*/React__default["default"].createElement(Typography, _extends({
15519
16005
  variant: "Body 2",
15520
16006
  weight: weight,
@@ -15572,62 +16058,10 @@
15572
16058
  return props.$isLight && styled.css(["background-color:var(--page-paper-main);box-shadow:var(--shadow-secondary);color:var(--color-theme-700);"]);
15573
16059
  });
15574
16060
 
15575
- var defaultStyle$2 = {
15576
- transitionProperty: "opacity, transform",
15577
- transitionDuration: ".15s, .10s, .15s",
15578
- transitionTimingFunction: "ease, ease, cubic-bezier(0.39, 0.575, 0.565, 1)",
15579
- transformOrigin: "50% 0",
15580
- transform: "scale(.85)",
15581
- opacity: 0
15582
- };
15583
- var transitionStyles$3 = {
15584
- entering: {
15585
- opacity: 1,
15586
- transform: "scale(1)",
15587
- transitionDelay: ".6s"
15588
- },
15589
- entered: {
15590
- opacity: 1,
15591
- transform: "scale(1)"
15592
- },
15593
- exiting: {
15594
- opacity: 0,
15595
- transform: "scale(.85)"
15596
- },
15597
- exited: {
15598
- opacity: 0,
15599
- transform: "scale(.85)"
15600
- }
15601
- };
15602
- var FromElement = function FromElement(_ref) {
15603
- var _ref$in = _ref.in,
15604
- inProp = _ref$in === void 0 ? false : _ref$in,
15605
- onEnter = _ref.onEnter,
15606
- onExited = _ref.onExited,
15607
- children = _ref.children,
15608
- style = _ref.style,
15609
- _ref$timeout = _ref.timeout,
15610
- timeout = _ref$timeout === void 0 ? 1000 : _ref$timeout;
15611
- return /*#__PURE__*/React__default["default"].createElement(reactTransitionGroup.Transition, {
15612
- appear: true,
15613
- in: inProp,
15614
- timeout: timeout,
15615
- onEnter: onEnter,
15616
- onExited: onExited
15617
- }, function (state) {
15618
- return /*#__PURE__*/React.cloneElement(children, {
15619
- style: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
15620
- visibility: state === "exited" && !inProp ? "hidden" : undefined
15621
- }, defaultStyle$2), transitionStyles$3[state]), style), children.props.style)
15622
- });
15623
- });
15624
- };
15625
- FromElement.displayName = "FromElement";
15626
-
15627
- var _excluded$1y = ["children"];
16061
+ var _excluded$1u = ["children"];
15628
16062
  var TooltipAnimation = function TooltipAnimation(_ref) {
15629
16063
  var children = _ref.children,
15630
- props = _objectWithoutProperties(_ref, _excluded$1y);
16064
+ props = _objectWithoutProperties(_ref, _excluded$1u);
15631
16065
  return /*#__PURE__*/React__default["default"].createElement(FromElement, _extends({
15632
16066
  timeout: 0
15633
16067
  }, props), children);
@@ -15709,7 +16143,7 @@
15709
16143
  });
15710
16144
  Tooltip.displayName = "Tooltip";
15711
16145
 
15712
- var _excluded$1x = ["label", "icon", "active", "counter", "tooltipText", "onClearAll", "className", "labelClassName", "disabled"];
16146
+ var _excluded$1t = ["label", "icon", "active", "counter", "tooltipText", "onClearAll", "className", "labelClassName", "disabled"];
15713
16147
  var CounterButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
15714
16148
  var label = _ref.label,
15715
16149
  icon = _ref.icon,
@@ -15722,7 +16156,7 @@
15722
16156
  labelClassName = _ref.labelClassName,
15723
16157
  _ref$disabled = _ref.disabled,
15724
16158
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
15725
- args = _objectWithoutProperties(_ref, _excluded$1x);
16159
+ args = _objectWithoutProperties(_ref, _excluded$1t);
15726
16160
  return /*#__PURE__*/React__default["default"].createElement(StyledCounterButtonWrapper, {
15727
16161
  ref: ref,
15728
16162
  className: className
@@ -15848,7 +16282,7 @@
15848
16282
  StyledButton$1.displayName = "StyledButton";
15849
16283
  StyledControl.displayName = "StyledControl";
15850
16284
 
15851
- var _excluded$1w = ["mixed", "data-testid"];
16285
+ var _excluded$1s = ["mixed", "data-testid"];
15852
16286
 
15853
16287
  /**
15854
16288
  * @component CheckboxIcon
@@ -15872,7 +16306,7 @@
15872
16306
  var CheckboxIcon = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, svgRef) {
15873
16307
  var mixed = _ref.mixed,
15874
16308
  testId = _ref["data-testid"],
15875
- props = _objectWithoutProperties(_ref, _excluded$1w);
16309
+ props = _objectWithoutProperties(_ref, _excluded$1s);
15876
16310
  // const [animate, setAnimate] = useState(false);
15877
16311
  // const mountRef = useRef(false);
15878
16312
 
@@ -15947,722 +16381,417 @@
15947
16381
  var StyledCheckbox$1 = styled__default["default"].div.withConfig({
15948
16382
  displayName: "Styles__StyledCheckbox",
15949
16383
  componentId: "sc-y7zymm-2"
15950
- })(["height:16px;width:16px;position:relative;transition-duration:0.2s;border-radius:2px;path{transition-duration:0.2s;stroke:transparent;stroke-dashoffset:12;stroke-dasharray:12;}svg{cursor:pointer;border-radius:2px;fill:transparent;}", " rect{transition-duration:0.2s;", " ", "}", ":disabled ~ ", "{opacity:0.5;cursor:not-allowed;}", ":focus ~ ", "{", "}&:not(.c-checkbox__controlled) ", ":hover:not(:checked) ~ ", "{path{stroke:var(--color-secondary-500);stroke-dashoffset:24;}rect{stroke:var(--color-secondary);", " stroke-width:3px;}}", " ", ":checked ~ ", "{path{", "}rect{stroke:var(--color-secondary);stroke-width:19px;", "}}"], function (props) {
15951
- return props.$disabled && styled.css(["svg{cursor:not-allowed;}"]);
15952
- }, function (props) {
15953
- return !props.mixed && styled.css(["stroke:var(--color-theme-500);"]);
15954
- }, function (props) {
15955
- return props.mixed && styled.css(["stroke:transparent;"]);
15956
- }, StyledInput$5, StyledLabel$1, StyledInput$5, StyledLabel$1, function (props) {
15957
- return !props.mixed && styled.css(["rect{stroke:var(--color-secondary);stroke-width:3px;}"]);
15958
- }, StyledInput$5, StyledLabel$1, function (props) {
15959
- return props.mixed && styled.css(["stroke:transparent;"]);
15960
- }, function (props) {
15961
- return props.hover && !props.mixed && styled.css(["", ":not(:checked) ~ ", "{path{stroke:var(--color-secondary-500);stroke-dashoffset:24;}rect{stroke:var(--color-secondary);stroke-width:3px;}}"], StyledInput$5, StyledLabel$1);
15962
- }, StyledInput$5, StyledLabel$1, function (props) {
15963
- return !props.mixed && styled.css(["stroke:var(--page-paper-main);stroke-dashoffset:24;"]);
15964
- }, function (props) {
15965
- return props.mixed && styled.css(["stroke:transparent;"]);
15966
- });
15967
- StyledCheckbox$1.displayName = "StyledCheckbox";
15968
-
15969
- var _excluded$1v = ["className", "hover", "id", "mixed", "checked", "onChange", "disabled"];
15970
- /**
15971
- * Checkbox component
15972
- */
15973
- var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
15974
- var className = _ref.className,
15975
- hover = _ref.hover,
15976
- _ref$id = _ref.id,
15977
- id = _ref$id === void 0 ? "checkbox" : _ref$id,
15978
- _ref$mixed = _ref.mixed,
15979
- mixed = _ref$mixed === void 0 ? false : _ref$mixed,
15980
- checked = _ref.checked,
15981
- onChange = _ref.onChange,
15982
- disabled = _ref.disabled,
15983
- rest = _objectWithoutProperties(_ref, _excluded$1v);
15984
- var _useState = React.useState(mixed && !checked),
15985
- _useState2 = _slicedToArray(_useState, 2),
15986
- indeterminate = _useState2[0],
15987
- setIndeterminate = _useState2[1];
15988
- var _useState3 = React.useState(checked),
15989
- _useState4 = _slicedToArray(_useState3, 2),
15990
- initialChecked = _useState4[0],
15991
- setInitialChecked = _useState4[1];
15992
- var handleChange = React.useCallback(function (e) {
15993
- typeof onChange === "function" && onChange(e);
15994
- setInitialChecked(function (prev) {
15995
- return !prev;
15996
- });
15997
- setIndeterminate(false);
15998
- }, [onChange]);
15999
- React.useEffect(function () {
16000
- if (checked !== initialChecked) {
16001
- setInitialChecked(checked);
16002
- setIndeterminate(false);
16003
- }
16004
- // eslint-disable-next-line react-hooks/exhaustive-deps
16005
- }, [checked]);
16006
- React.useEffect(function () {
16007
- if (mixed !== indeterminate && !checked) {
16008
- setIndeterminate(mixed);
16009
- }
16010
- // eslint-disable-next-line react-hooks/exhaustive-deps
16011
- }, [mixed]);
16012
- return /*#__PURE__*/React__default["default"].createElement(StyledCheckbox$1, {
16013
- className: classNames__default["default"]("c-checkbox", {
16014
- "c-checkbox__hover": hover,
16015
- "c-checkbox__controlled": typeof hover === "boolean"
16016
- }, className),
16017
- hover: hover,
16018
- tabIndex: -1,
16019
- mixed: indeterminate,
16020
- $disabled: disabled
16021
- }, /*#__PURE__*/React__default["default"].createElement(StyledInput$5, _extends({
16022
- role: "checkbox",
16023
- id: id,
16024
- className: "c-checkbox--input",
16025
- type: "checkbox",
16026
- ref: ref
16027
- }, rest, {
16028
- checked: initialChecked,
16029
- onChange: handleChange,
16030
- disabled: disabled
16031
- })), /*#__PURE__*/React__default["default"].createElement(StyledLabel$1, {
16032
- htmlFor: id,
16033
- className: "c-checkbox--label"
16034
- }, /*#__PURE__*/React__default["default"].createElement(CheckboxIcon$1, {
16035
- "data-testid": "checkbox-icon",
16036
- height: 16,
16037
- width: 16,
16038
- mixed: indeterminate
16039
- })));
16040
- });
16041
- Checkbox.displayName = "Checkbox";
16042
-
16043
- var DialogContext = /*#__PURE__*/React.createContext(null);
16044
- var useDialogContext = function useDialogContext() {
16045
- return React.useContext(DialogContext);
16046
- };
16047
-
16048
- /**
16049
- * Closes the dialog the way clicking the overlay does: the exit transition runs first, and the
16050
- * dialog's own onClose fires once it finishes. Use it for a Cancel button instead of calling the
16051
- * parent's close handler, which would unmount the dialog before it can animate out.
16052
- */
16053
- var useDialogClose = function useDialogClose(fallback) {
16054
- var _ref, _context$requestClose;
16055
- var context = React.useContext(DialogContext);
16056
- return (_ref = (_context$requestClose = context === null || context === void 0 ? void 0 : context.requestClose) !== null && _context$requestClose !== void 0 ? _context$requestClose : fallback) !== null && _ref !== void 0 ? _ref : function () {
16057
- return undefined;
16058
- };
16059
- };
16060
-
16061
- var size = {
16062
- sm: "640px",
16063
- md: "768px",
16064
- lg: "1024px",
16065
- xl: "1280px",
16066
- xxl: "1536px"
16067
- };
16068
- var screen = {
16069
- sm: "@media (min-width: ".concat(size.sm, ")"),
16070
- md: "@media (min-width: ".concat(size.md, ")"),
16071
- lg: "@media (min-width: ".concat(size.lg, ")"),
16072
- xl: "@media (min-width: ".concat(size.xl, ")"),
16073
- xxl: "@media (min-width: ".concat(size.xxl, ")")
16074
- };
16075
- // 0.02px below the breakpoint so these never overlap the min-width queries.
16076
- var below = function below(value) {
16077
- return "".concat(parseFloat(value) - 0.02, "px");
16078
- };
16079
- var screenBelow = {
16080
- sm: "@media (max-width: ".concat(below(size.sm), ")"),
16081
- md: "@media (max-width: ".concat(below(size.md), ")"),
16082
- lg: "@media (max-width: ".concat(below(size.lg), ")"),
16083
- xl: "@media (max-width: ".concat(below(size.xl), ")"),
16084
- xxl: "@media (max-width: ".concat(below(size.xxl), ")")
16085
- };
16086
-
16087
- var dialogSizes = {
16088
- s: 440,
16089
- m: 540,
16090
- l: 700,
16091
- xl: 840,
16092
- xxl: 1000,
16093
- xxxl: 1120
16094
- };
16095
- var MIN_GAP = "2.5vh";
16096
- var MAX_DIALOG_HEIGHT = "95vh";
16097
-
16098
- // The dialog hangs at a fixed offset while there is room below it, then grows in both directions at
16099
- // once. Two shrinkable spacers express that: only the lower one grows, and past the crossover both
16100
- // shrink from the same basis, so the gaps stay equal down to MIN_GAP.
16101
- var StyledDialogViewport = styled__default["default"].div.withConfig({
16102
- displayName: "Styles__StyledDialogViewport",
16103
- componentId: "sc-jwpvgm-0"
16104
- })(["position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;align-items:center;padding-left:16px;padding-right:16px;pointer-events:none;--ac-dialog-offset:60px;", "{--ac-dialog-offset:126px;}&::before,&::after{content:\"\";flex-shrink:1;flex-basis:var(--ac-dialog-offset);min-height:", ";}&::before{flex-grow:0;}&::after{flex-grow:1;}", ""], screen.sm, MIN_GAP, BoxSizingStyle);
16105
- StyledDialogViewport.displayName = "StyledDialogViewport";
16106
- var StyledDialog = styled__default["default"].div.withConfig({
16107
- displayName: "Styles__StyledDialog",
16108
- componentId: "sc-jwpvgm-1"
16109
- })(["display:flex;flex-direction:column;flex:0 0 auto;pointer-events:auto;width:100%;max-width:", "px;max-height:", ";background-color:var(--page-paper-main);color:var(--color-theme-900);box-shadow:var(--shadow-primary);border-radius:8px;position:relative;transition:max-width 0.2s ease,height 0.2s ease;@media (prefers-reduced-motion:reduce){transition:none;}", " ", " ", ""], function (props) {
16110
- return props.$maxWidth;
16111
- }, MAX_DIALOG_HEIGHT, function (props) {
16112
- return props.$height && styled.css(["height:", ";"], props.$height);
16113
- }, FontStyle, BoxSizingStyle);
16114
- StyledDialog.displayName = "StyledDialog";
16115
- var StyledDialogTitle = styled__default["default"].div.withConfig({
16116
- displayName: "Styles__StyledDialogTitle",
16117
- componentId: "sc-jwpvgm-2"
16118
- })(["padding:20px 30px;flex:0 0 auto;", " ", ""], FontStyle, BoxSizingStyle);
16119
- StyledDialogTitle.displayName = "StyledDialogTitle";
16120
-
16121
- // The close button hangs 8px into the title padding, so it sits nearer the dialog edge than the
16122
- // heading does. The bar reserves the rest, which keeps the gap to the heading unchanged.
16123
- var CLOSE_OFFSET = 8;
16124
- var CLOSE_RESERVE = 44 - CLOSE_OFFSET;
16125
-
16126
- // The header is as tall as its heading, with or without a close button.
16127
- var StyledDialogTitleBar = styled__default["default"].div.withConfig({
16128
- displayName: "Styles__StyledDialogTitleBar",
16129
- componentId: "sc-jwpvgm-3"
16130
- })(["position:relative;display:flex;align-items:center;padding-right:", "px;"], CLOSE_RESERVE);
16131
- StyledDialogTitleBar.displayName = "StyledDialogTitleBar";
16132
- var StyledDialogTitleClose = styled__default["default"].div.withConfig({
16133
- displayName: "Styles__StyledDialogTitleClose",
16134
- componentId: "sc-jwpvgm-4"
16135
- })(["position:absolute;right:-", "px;top:50%;transform:translateY(-50%);line-height:0;"], CLOSE_OFFSET);
16136
- StyledDialogTitleClose.displayName = "StyledDialogTitleClose";
16137
- var StyledDialogContent = styled__default["default"].div.withConfig({
16138
- displayName: "Styles__StyledDialogContent",
16139
- componentId: "sc-jwpvgm-5"
16140
- })(["padding:20px 30px;flex:1 1 auto;min-height:0;overflow-y:", ";", " ", ""], function (props) {
16141
- return props.$scroll ? "auto" : "visible";
16142
- }, FontStyle, BoxSizingStyle);
16143
- StyledDialogContent.displayName = "StyledDialogContent";
16144
- var StyledDialogContentDivider = styled__default["default"].div.withConfig({
16145
- displayName: "Styles__StyledDialogContentDivider",
16146
- componentId: "sc-jwpvgm-6"
16147
- })(["border-top:1px solid var(--border-primary);height:1px;flex:0 0 auto;"]);
16148
- StyledDialogContentDivider.displayName = "StyledDialogContentDivider";
16149
- var StyledDialogActions = styled__default["default"].div.withConfig({
16150
- displayName: "Styles__StyledDialogActions",
16151
- componentId: "sc-jwpvgm-7"
16152
- })(["padding:20px 30px;flex:0 0 auto;display:flex;align-items:center;gap:12px;", " ", ""], FontStyle, BoxSizingStyle);
16153
- StyledDialogActions.displayName = "StyledDialogActions";
16154
-
16155
- var _excluded$1u = ["className", "children"];
16156
- var DialogActions = function DialogActions(_ref) {
16157
- var className = _ref.className,
16158
- children = _ref.children,
16159
- rest = _objectWithoutProperties(_ref, _excluded$1u);
16160
- var dialog = useDialogContext();
16161
-
16162
- // A footer button that does nothing but close gets the same path as clicking the overlay, so the
16163
- // exit transition runs before the caller unmounts the dialog. Matching on identity leaves a
16164
- // button that does anything else alone.
16165
- var wired = dialog !== null && dialog !== void 0 && dialog.requestClose && dialog !== null && dialog !== void 0 && dialog.onClose ? React.Children.map(children, function (child) {
16166
- return /*#__PURE__*/React.isValidElement(child) && child.props.onClick === dialog.onClose ? /*#__PURE__*/React.cloneElement(child, {
16167
- onClick: dialog.requestClose
16168
- }) : child;
16169
- }) : children;
16170
- return /*#__PURE__*/React__default["default"].createElement(StyledDialogActions, _extends({
16171
- className: classNames__default["default"]("c-dialog-actions", className)
16172
- }, rest), wired);
16173
- };
16174
- DialogActions.displayName = "DialogActions";
16175
-
16176
- var _excluded$1t = ["className", "children", "scroll"];
16177
- var DialogContent = function DialogContent(_ref) {
16178
- var className = _ref.className,
16179
- children = _ref.children,
16180
- _ref$scroll = _ref.scroll,
16181
- scroll = _ref$scroll === void 0 ? true : _ref$scroll,
16182
- rest = _objectWithoutProperties(_ref, _excluded$1t);
16183
- return /*#__PURE__*/React__default["default"].createElement(StyledDialogContent, _extends({
16184
- $scroll: scroll,
16185
- className: classNames__default["default"]("c-dialog-content", className)
16186
- }, rest), children);
16187
- };
16188
- DialogContent.displayName = "DialogContent";
16189
-
16190
- // import { useDialogContext } from "./DialogContext";
16191
-
16192
- var DialogContentDivider = function DialogContentDivider(_ref) {
16193
- var className = _ref.className;
16194
- // useDialogContext();
16195
-
16196
- return /*#__PURE__*/React__default["default"].createElement(StyledDialogContentDivider, {
16197
- className: classNames__default["default"]("c-dialog-content-divider", className)
16198
- });
16199
- };
16200
- DialogContentDivider.displayName = "DialogContentDivider";
16201
-
16202
- var _excluded$1s = ["children"];
16203
- var Header3 = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
16204
- var children = _ref.children,
16205
- props = _objectWithoutProperties(_ref, _excluded$1s);
16206
- return /*#__PURE__*/React__default["default"].createElement(Typography, _extends({
16207
- weight: "bold",
16208
- variant: "Header 3",
16209
- ref: ref
16210
- }, props), children);
16384
+ })(["height:16px;width:16px;position:relative;transition-duration:0.2s;border-radius:2px;path{transition-duration:0.2s;stroke:transparent;stroke-dashoffset:12;stroke-dasharray:12;}svg{cursor:pointer;border-radius:2px;fill:transparent;}", " rect{transition-duration:0.2s;", " ", "}", ":disabled ~ ", "{opacity:0.5;cursor:not-allowed;}", ":focus ~ ", "{", "}&:not(.c-checkbox__controlled) ", ":hover:not(:checked) ~ ", "{path{stroke:var(--color-secondary-500);stroke-dashoffset:24;}rect{stroke:var(--color-secondary);", " stroke-width:3px;}}", " ", ":checked ~ ", "{path{", "}rect{stroke:var(--color-secondary);stroke-width:19px;", "}}"], function (props) {
16385
+ return props.$disabled && styled.css(["svg{cursor:not-allowed;}"]);
16386
+ }, function (props) {
16387
+ return !props.mixed && styled.css(["stroke:var(--color-theme-500);"]);
16388
+ }, function (props) {
16389
+ return props.mixed && styled.css(["stroke:transparent;"]);
16390
+ }, StyledInput$5, StyledLabel$1, StyledInput$5, StyledLabel$1, function (props) {
16391
+ return !props.mixed && styled.css(["rect{stroke:var(--color-secondary);stroke-width:3px;}"]);
16392
+ }, StyledInput$5, StyledLabel$1, function (props) {
16393
+ return props.mixed && styled.css(["stroke:transparent;"]);
16394
+ }, function (props) {
16395
+ return props.hover && !props.mixed && styled.css(["", ":not(:checked) ~ ", "{path{stroke:var(--color-secondary-500);stroke-dashoffset:24;}rect{stroke:var(--color-secondary);stroke-width:3px;}}"], StyledInput$5, StyledLabel$1);
16396
+ }, StyledInput$5, StyledLabel$1, function (props) {
16397
+ return !props.mixed && styled.css(["stroke:var(--page-paper-main);stroke-dashoffset:24;"]);
16398
+ }, function (props) {
16399
+ return props.mixed && styled.css(["stroke:transparent;"]);
16211
16400
  });
16212
- Header3.displayName = "Header3";
16401
+ StyledCheckbox$1.displayName = "StyledCheckbox";
16213
16402
 
16214
- var _excluded$1r = ["children", "className", "disableDefaultHeading", "onClose", "closeLabel"];
16215
- var DialogTitle = function DialogTitle(_ref) {
16216
- var _dialog$requestClose;
16217
- var children = _ref.children,
16218
- className = _ref.className,
16219
- _ref$disableDefaultHe = _ref.disableDefaultHeading,
16220
- disableDefaultHeading = _ref$disableDefaultHe === void 0 ? false : _ref$disableDefaultHe,
16221
- onClose = _ref.onClose,
16222
- _ref$closeLabel = _ref.closeLabel,
16223
- closeLabel = _ref$closeLabel === void 0 ? "Close" : _ref$closeLabel,
16403
+ var _excluded$1r = ["className", "hover", "id", "mixed", "checked", "onChange", "disabled"];
16404
+ /**
16405
+ * Checkbox component
16406
+ */
16407
+ var Checkbox = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
16408
+ var className = _ref.className,
16409
+ hover = _ref.hover,
16410
+ _ref$id = _ref.id,
16411
+ id = _ref$id === void 0 ? "checkbox" : _ref$id,
16412
+ _ref$mixed = _ref.mixed,
16413
+ mixed = _ref$mixed === void 0 ? false : _ref$mixed,
16414
+ checked = _ref.checked,
16415
+ onChange = _ref.onChange,
16416
+ disabled = _ref.disabled,
16224
16417
  rest = _objectWithoutProperties(_ref, _excluded$1r);
16225
- var dialog = useDialogContext();
16226
- var heading = disableDefaultHeading ? children : /*#__PURE__*/React__default["default"].createElement(Header3, null, children);
16227
-
16228
- // Closing through the dialog lets the exit transition run; the caller's onClose fires once it
16229
- // finishes. Falling back keeps a title used outside a dialog working.
16230
- var handleClose = (_dialog$requestClose = dialog === null || dialog === void 0 ? void 0 : dialog.requestClose) !== null && _dialog$requestClose !== void 0 ? _dialog$requestClose : onClose;
16231
- return /*#__PURE__*/React__default["default"].createElement(StyledDialogTitle, _extends({
16232
- className: classNames__default["default"]("c-dialog-title-wrapper", className)
16233
- }, rest), onClose ? /*#__PURE__*/React__default["default"].createElement(StyledDialogTitleBar, null, heading, /*#__PURE__*/React__default["default"].createElement(StyledDialogTitleClose, null, /*#__PURE__*/React__default["default"].createElement(IconButton, {
16234
- type: "button",
16235
- variant: "text gray",
16236
- "aria-label": closeLabel,
16237
- onClick: handleClose
16238
- }, /*#__PURE__*/React__default["default"].createElement(CancelCrossIcon$1, null)))) : heading);
16239
- };
16240
- DialogTitle.displayName = "DialogTitle";
16241
-
16242
- function createChainedFunction() {
16243
- for (var _len = arguments.length, functions = new Array(_len), _key = 0; _key < _len; _key++) {
16244
- functions[_key] = arguments[_key];
16245
- }
16246
- return functions.reduce(function (acc, func) {
16247
- if (func === null) {
16248
- return acc;
16249
- }
16250
- return function chainedFunction() {
16251
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
16252
- args[_key2] = arguments[_key2];
16253
- }
16254
- acc && acc.apply(this, args);
16255
- func && func.apply(this, args);
16256
- };
16257
- },
16258
- // eslint-disable-next-line @typescript-eslint/no-empty-function
16259
- function () {});
16260
- }
16261
-
16262
- var _excluded$1q = ["children", "disableFocusLock", "disableScrollLock", "disableBackgroundClick", "disableBackgroundColor", "disableCloseOnEsc", "open", "onClose", "onClickOutside"];
16263
- var getHasTransition = function getHasTransition(children) {
16264
- return children.props ? Object.prototype.hasOwnProperty.call(children.props, "in") : false;
16265
- };
16266
- var Modal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
16267
- var children = _ref.children,
16268
- _ref$disableFocusLock = _ref.disableFocusLock,
16269
- disableFocusLock = _ref$disableFocusLock === void 0 ? false : _ref$disableFocusLock,
16270
- _ref$disableScrollLoc = _ref.disableScrollLock,
16271
- disableScrollLock = _ref$disableScrollLoc === void 0 ? false : _ref$disableScrollLoc,
16272
- _ref$disableBackgroun = _ref.disableBackgroundClick,
16273
- disableBackgroundClick = _ref$disableBackgroun === void 0 ? false : _ref$disableBackgroun,
16274
- _ref$disableBackgroun2 = _ref.disableBackgroundColor,
16275
- disableBackgroundColor = _ref$disableBackgroun2 === void 0 ? false : _ref$disableBackgroun2,
16276
- _ref$disableCloseOnEs = _ref.disableCloseOnEsc,
16277
- disableCloseOnEsc = _ref$disableCloseOnEs === void 0 ? false : _ref$disableCloseOnEs,
16278
- _ref$open = _ref.open,
16279
- defaultOpen = _ref$open === void 0 ? false : _ref$open,
16280
- onClose = _ref.onClose,
16281
- onClickOutside = _ref.onClickOutside,
16282
- rest = _objectWithoutProperties(_ref, _excluded$1q);
16283
- var _useState = React.useState(defaultOpen),
16418
+ var _useState = React.useState(mixed && !checked),
16284
16419
  _useState2 = _slicedToArray(_useState, 2),
16285
- open = _useState2[0],
16286
- setOpen = _useState2[1];
16287
- var _useState3 = React.useState(true),
16420
+ indeterminate = _useState2[0],
16421
+ setIndeterminate = _useState2[1];
16422
+ var _useState3 = React.useState(checked),
16288
16423
  _useState4 = _slicedToArray(_useState3, 2),
16289
- exited = _useState4[0],
16290
- setExited = _useState4[1];
16291
- var innerRef = React.useRef(null);
16292
- var handleRef = useForkRef(innerRef, ref);
16293
- var hasTransition = React.useMemo(function () {
16294
- return getHasTransition(children);
16295
- }, [children]);
16424
+ initialChecked = _useState4[0],
16425
+ setInitialChecked = _useState4[1];
16426
+ var handleChange = React.useCallback(function (e) {
16427
+ typeof onChange === "function" && onChange(e);
16428
+ setInitialChecked(function (prev) {
16429
+ return !prev;
16430
+ });
16431
+ setIndeterminate(false);
16432
+ }, [onChange]);
16296
16433
  React.useEffect(function () {
16297
- setOpen(defaultOpen);
16298
- }, [defaultOpen]);
16299
- var handleClose = React.useCallback(function () {
16300
- setOpen(false);
16301
- if (!hasTransition) {
16302
- typeof onClose === "function" && onClose();
16303
- }
16304
- }, [hasTransition, onClose]);
16305
- var handleBackgroundClick = React.useCallback(function (event) {
16306
- if (!disableBackgroundClick) {
16307
- event.preventDefault();
16308
- return handleClose();
16309
- }
16310
- if (onClickOutside) {
16311
- onClickOutside(event);
16434
+ if (checked !== initialChecked) {
16435
+ setInitialChecked(checked);
16436
+ setIndeterminate(false);
16312
16437
  }
16313
- }, [disableBackgroundClick, onClickOutside, handleClose]);
16314
- var handleEnter = React.useCallback(function () {
16315
- setExited(false);
16316
- }, []);
16317
- var handleExited = React.useCallback(function () {
16318
- setExited(true);
16319
- typeof onClose === "function" && onClose();
16320
- }, [onClose]);
16321
- var childProps = React.useMemo(function () {
16322
- var props = {};
16323
-
16324
- // It's a Transition like component
16325
- if (hasTransition && children) {
16326
- props = {
16327
- onEnter: createChainedFunction(handleEnter, children.props.onEnter),
16328
- onExited: createChainedFunction(handleExited, children.props.onExited),
16329
- in: open,
16330
- forceClose: handleClose
16331
- };
16438
+ // eslint-disable-next-line react-hooks/exhaustive-deps
16439
+ }, [checked]);
16440
+ React.useEffect(function () {
16441
+ if (mixed !== indeterminate && !checked) {
16442
+ setIndeterminate(mixed);
16332
16443
  }
16333
- return props;
16334
- }, [children, handleClose, handleEnter, handleExited, hasTransition, open]);
16335
- if (!open && (!hasTransition || exited)) {
16336
- return null;
16337
- }
16338
- return /*#__PURE__*/React__default["default"].createElement(Window, _extends({}, rest, {
16339
- ref: handleRef,
16340
- onClose: handleClose,
16341
- disableFocusLock: disableFocusLock,
16342
- disableScrollLock: disableScrollLock,
16343
- disableCloseOnEsc: disableCloseOnEsc
16344
- }), open ? /*#__PURE__*/React__default["default"].createElement(Overlay, {
16345
- onClick: handleBackgroundClick,
16346
- disableBackgroundColor: disableBackgroundColor
16347
- }) : null, /*#__PURE__*/React.cloneElement(children, childProps));
16444
+ // eslint-disable-next-line react-hooks/exhaustive-deps
16445
+ }, [mixed]);
16446
+ return /*#__PURE__*/React__default["default"].createElement(StyledCheckbox$1, {
16447
+ className: classNames__default["default"]("c-checkbox", {
16448
+ "c-checkbox__hover": hover,
16449
+ "c-checkbox__controlled": typeof hover === "boolean"
16450
+ }, className),
16451
+ hover: hover,
16452
+ tabIndex: -1,
16453
+ mixed: indeterminate,
16454
+ $disabled: disabled
16455
+ }, /*#__PURE__*/React__default["default"].createElement(StyledInput$5, _extends({
16456
+ role: "checkbox",
16457
+ id: id,
16458
+ className: "c-checkbox--input",
16459
+ type: "checkbox",
16460
+ ref: ref
16461
+ }, rest, {
16462
+ checked: initialChecked,
16463
+ onChange: handleChange,
16464
+ disabled: disabled
16465
+ })), /*#__PURE__*/React__default["default"].createElement(StyledLabel$1, {
16466
+ htmlFor: id,
16467
+ className: "c-checkbox--label"
16468
+ }, /*#__PURE__*/React__default["default"].createElement(CheckboxIcon$1, {
16469
+ "data-testid": "checkbox-icon",
16470
+ height: 16,
16471
+ width: 16,
16472
+ mixed: indeterminate
16473
+ })));
16348
16474
  });
16349
- Modal.displayName = "Modal";
16475
+ Checkbox.displayName = "Checkbox";
16350
16476
 
16351
- var _excluded$1p = ["in", "children", "style", "timeout", "onEnter"];
16352
- var defaultStyle$1 = function defaultStyle(duration) {
16353
- return {
16354
- transition: "all ".concat(duration, "ms ease-in-out"),
16355
- opacity: 0
16356
- };
16357
- };
16358
- var transitionStyles$2 = {
16359
- entering: {
16360
- opacity: 1
16361
- },
16362
- entered: {
16363
- opacity: 1
16364
- },
16365
- exiting: {
16366
- opacity: 0
16367
- },
16368
- exited: {
16369
- opacity: 0
16370
- }
16371
- };
16372
- var Fade = function Fade(_ref) {
16373
- var _ref$in = _ref.in,
16374
- inProp = _ref$in === void 0 ? false : _ref$in,
16375
- children = _ref.children,
16376
- style = _ref.style,
16377
- _ref$timeout = _ref.timeout,
16378
- timeout = _ref$timeout === void 0 ? 500 : _ref$timeout,
16379
- onEnter = _ref.onEnter,
16380
- rest = _objectWithoutProperties(_ref, _excluded$1p);
16381
- // Same forced layout as SlideFromTop: without it the starting opacity never lands in the DOM.
16382
- var handleEnter = function handleEnter(node, isAppearing) {
16383
- if (node) {
16384
- void node.offsetHeight;
16385
- }
16386
- onEnter === null || onEnter === void 0 || onEnter(node, isAppearing);
16387
- };
16388
- return /*#__PURE__*/React__default["default"].createElement(reactTransitionGroup.Transition, _extends({
16389
- appear: true,
16390
- in: inProp,
16391
- timeout: timeout,
16392
- onEnter: handleEnter
16393
- }, rest), function (state) {
16394
- return /*#__PURE__*/React.cloneElement(children, {
16395
- style: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
16396
- visibility: state === "exited" && !inProp ? "hidden" : undefined
16397
- }, defaultStyle$1(timeout)), transitionStyles$2[state]), style), children.props.style)
16398
- });
16399
- });
16477
+ var DialogContext = /*#__PURE__*/React.createContext(null);
16478
+ var useDialogContext = function useDialogContext() {
16479
+ return React.useContext(DialogContext);
16400
16480
  };
16401
- Fade.displayName = "Fade";
16402
16481
 
16403
- var _excluded$1o = ["in", "children", "style", "timeout", "initialDirection"];
16404
- var Slide = function Slide(_ref) {
16405
- var _ref$in = _ref.in,
16406
- inProp = _ref$in === void 0 ? false : _ref$in,
16407
- children = _ref.children,
16408
- style = _ref.style,
16409
- _ref$timeout = _ref.timeout,
16410
- timeout = _ref$timeout === void 0 ? 300 : _ref$timeout,
16411
- _ref$initialDirection = _ref.initialDirection,
16412
- initialDirection = _ref$initialDirection === void 0 ? "left" : _ref$initialDirection,
16413
- rest = _objectWithoutProperties(_ref, _excluded$1o);
16414
- var directionSign;
16415
- switch (initialDirection) {
16416
- case "right":
16417
- directionSign = "100%, 0";
16418
- break;
16419
- case "top":
16420
- directionSign = "0, -100%";
16421
- break;
16422
- case "bottom":
16423
- directionSign = "0, 100%";
16424
- break;
16425
- default:
16426
- directionSign = "-100%, 0";
16427
- }
16428
- var defaultStyle = function defaultStyle(timeout) {
16429
- return {
16430
- transition: "all ".concat(timeout, "ms ease")
16431
- };
16432
- };
16433
- var transitionStyles = {
16434
- entering: {
16435
- transform: "translate(0,0)"
16436
- },
16437
- entered: {
16438
- transform: "translate(0,0)"
16439
- },
16440
- exiting: {
16441
- transform: "translate(".concat(directionSign, ")")
16442
- },
16443
- exited: {
16444
- transform: "translate(".concat(directionSign, ")")
16445
- }
16482
+ /**
16483
+ * Closes the dialog the way clicking the overlay does: the exit transition runs first, and the
16484
+ * dialog's own onClose fires once it finishes. Use it for a Cancel button instead of calling the
16485
+ * parent's close handler, which would unmount the dialog before it can animate out.
16486
+ */
16487
+ var useDialogClose = function useDialogClose(fallback) {
16488
+ var _ref, _context$requestClose;
16489
+ var context = React.useContext(DialogContext);
16490
+ return (_ref = (_context$requestClose = context === null || context === void 0 ? void 0 : context.requestClose) !== null && _context$requestClose !== void 0 ? _context$requestClose : fallback) !== null && _ref !== void 0 ? _ref : function () {
16491
+ return undefined;
16446
16492
  };
16447
- return /*#__PURE__*/React__default["default"].createElement(reactTransitionGroup.Transition, _extends({
16448
- in: inProp,
16449
- timeout: timeout
16450
- }, rest), function (state) {
16451
- return /*#__PURE__*/React.cloneElement(children, {
16452
- style: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
16453
- visibility: state === "exited" && !inProp ? "hidden" : undefined
16454
- }, defaultStyle(timeout)), transitionStyles[state]), style), children.props.style)
16455
- });
16456
- });
16457
16493
  };
16458
- Slide.displayName = "Slide";
16459
16494
 
16460
- var DEFAULT_DISTANCE = 25;
16461
- var buildStyles = function buildStyles(distance) {
16462
- var away = "translateY(-".concat(distance, "px)");
16463
- return {
16464
- base: {
16465
- transitionProperty: "opacity, transform",
16466
- transitionTimingFunction: "ease-out",
16467
- transform: away,
16468
- opacity: 0
16469
- },
16470
- entering: {
16471
- opacity: 1,
16472
- transform: "translateY(0)",
16473
- transitionDuration: ".3s"
16474
- },
16475
- entered: {
16476
- opacity: 1,
16477
- transform: "translateY(0)",
16478
- transitionDuration: ".3s"
16479
- },
16480
- exiting: {
16481
- opacity: 0,
16482
- transform: away,
16483
- transitionDuration: ".2s"
16484
- },
16485
- exited: {
16486
- opacity: 0,
16487
- transform: away,
16488
- transitionDuration: ".2s"
16489
- }
16490
- };
16495
+ var size = {
16496
+ sm: "640px",
16497
+ md: "768px",
16498
+ lg: "1024px",
16499
+ xl: "1280px",
16500
+ xxl: "1536px"
16501
+ };
16502
+ var screen = {
16503
+ sm: "@media (min-width: ".concat(size.sm, ")"),
16504
+ md: "@media (min-width: ".concat(size.md, ")"),
16505
+ lg: "@media (min-width: ".concat(size.lg, ")"),
16506
+ xl: "@media (min-width: ".concat(size.xl, ")"),
16507
+ xxl: "@media (min-width: ".concat(size.xxl, ")")
16508
+ };
16509
+ // 0.02px below the breakpoint so these never overlap the min-width queries.
16510
+ var below = function below(value) {
16511
+ return "".concat(parseFloat(value) - 0.02, "px");
16512
+ };
16513
+ var screenBelow = {
16514
+ sm: "@media (max-width: ".concat(below(size.sm), ")"),
16515
+ md: "@media (max-width: ".concat(below(size.md), ")"),
16516
+ lg: "@media (max-width: ".concat(below(size.lg), ")"),
16517
+ xl: "@media (max-width: ".concat(below(size.xl), ")"),
16518
+ xxl: "@media (max-width: ".concat(below(size.xxl), ")")
16491
16519
  };
16492
- var SlideFromTop = function SlideFromTop(_ref) {
16493
- var _ref$in = _ref.in,
16494
- inProp = _ref$in === void 0 ? false : _ref$in,
16495
- onEnter = _ref.onEnter,
16496
- onExited = _ref.onExited,
16497
- children = _ref.children,
16498
- style = _ref.style,
16499
- _ref$timeout = _ref.timeout,
16500
- timeout = _ref$timeout === void 0 ? 400 : _ref$timeout,
16501
- _ref$distance = _ref.distance,
16502
- distance = _ref$distance === void 0 ? DEFAULT_DISTANCE : _ref$distance;
16503
- var styles = buildStyles(distance);
16504
16520
 
16505
- // React flushes the state change that follows onEnter before the browser paints, so without a
16506
- // forced layout here the element never holds its starting style and the transition is skipped.
16507
- var handleEnter = function handleEnter(node, isAppearing) {
16508
- if (node) {
16509
- void node.offsetHeight;
16510
- }
16511
- onEnter === null || onEnter === void 0 || onEnter(node, isAppearing);
16512
- };
16513
- return /*#__PURE__*/React__default["default"].createElement(reactTransitionGroup.Transition, {
16514
- appear: true,
16515
- in: inProp,
16516
- timeout: timeout,
16517
- onEnter: handleEnter,
16518
- onExited: onExited
16519
- }, function (state) {
16520
- return /*#__PURE__*/React.cloneElement(children, {
16521
- style: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
16522
- visibility: state === "exited" && !inProp ? "hidden" : undefined
16523
- }, styles.base), styles[state]), style), children.props.style)
16524
- });
16525
- });
16521
+ var dialogSizes = {
16522
+ s: 440,
16523
+ m: 540,
16524
+ l: 700,
16525
+ xl: 840,
16526
+ xxl: 1000,
16527
+ xxxl: 1120
16526
16528
  };
16527
- SlideFromTop.displayName = "SlideFromTop";
16529
+ var MIN_GAP = "2.5vh";
16530
+ var MAX_DIALOG_HEIGHT = "95vh";
16528
16531
 
16529
- var StyledSlideLeftRight = styled.createGlobalStyle(["", " ", ""], function (props) {
16530
- return props.$direction === "left" && styled.css(["&.c-slide-enter{position:absolute;transform:translateX(100%);}&.c-slide-enter-active{transform:translateX(0%);transition:all 200ms ease;}&.c-slide-exit{position:absolute;}&.c-slide-exit-active{transform:translateX(-100%);transition:all 200ms ease;}"]);
16531
- }, function (props) {
16532
- return props.$direction === "right" && styled.css(["&.c-slide-enter{position:absolute;transform:translateX(-100%);}&.c-slide-enter-active{transform:translateX(0%);transition:all 200ms ease;}&.c-slide-exit{position:absolute;}&.c-slide-exit-active{transform:translateX(100%);transition:all 200ms ease;}"]);
16533
- });
16532
+ // The dialog hangs at a fixed offset while there is room below it, then grows in both directions at
16533
+ // once. Two shrinkable spacers express that: only the lower one grows, and past the crossover both
16534
+ // shrink from the same basis, so the gaps stay equal down to MIN_GAP.
16535
+ var StyledDialogViewport = styled__default["default"].div.withConfig({
16536
+ displayName: "Styles__StyledDialogViewport",
16537
+ componentId: "sc-jwpvgm-0"
16538
+ })(["position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;align-items:center;padding-left:16px;padding-right:16px;pointer-events:none;--ac-dialog-offset:60px;", "{--ac-dialog-offset:126px;}&::before,&::after{content:\"\";flex-shrink:1;flex-basis:var(--ac-dialog-offset);min-height:", ";}&::before{flex-grow:0;}&::after{flex-grow:1;}", ""], screen.sm, MIN_GAP, BoxSizingStyle);
16539
+ StyledDialogViewport.displayName = "StyledDialogViewport";
16540
+ var StyledDialog = styled__default["default"].div.withConfig({
16541
+ displayName: "Styles__StyledDialog",
16542
+ componentId: "sc-jwpvgm-1"
16543
+ })(["display:flex;flex-direction:column;flex:0 0 auto;pointer-events:auto;width:100%;max-width:", "px;max-height:", ";background-color:var(--page-paper-main);color:var(--color-theme-900);box-shadow:var(--shadow-primary);border-radius:8px;position:relative;transition:max-width 0.2s ease,height 0.2s ease;@media (prefers-reduced-motion:reduce){transition:none;}", " ", " ", ""], function (props) {
16544
+ return props.$maxWidth;
16545
+ }, MAX_DIALOG_HEIGHT, function (props) {
16546
+ return props.$height && styled.css(["height:", ";"], props.$height);
16547
+ }, FontStyle, BoxSizingStyle);
16548
+ StyledDialog.displayName = "StyledDialog";
16549
+ var StyledDialogTitle = styled__default["default"].div.withConfig({
16550
+ displayName: "Styles__StyledDialogTitle",
16551
+ componentId: "sc-jwpvgm-2"
16552
+ })(["padding:20px 30px;flex:0 0 auto;", " ", ""], FontStyle, BoxSizingStyle);
16553
+ StyledDialogTitle.displayName = "StyledDialogTitle";
16534
16554
 
16535
- var _excluded$1n = ["children", "direction"];
16536
- var SlideLeftRightTransition = function SlideLeftRightTransition(_ref) {
16537
- var children = _ref.children,
16538
- _ref$direction = _ref.direction,
16539
- direction = _ref$direction === void 0 ? "left" : _ref$direction,
16540
- props = _objectWithoutProperties(_ref, _excluded$1n);
16541
- return /*#__PURE__*/React__default["default"].createElement(reactTransitionGroup.CSSTransition, _extends({
16542
- timeout: 200,
16543
- classNames: "c-slide",
16544
- unmountOnExit: true
16545
- }, props), /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, children, /*#__PURE__*/React__default["default"].createElement(StyledSlideLeftRight, {
16546
- $direction: direction
16547
- })));
16555
+ // The close button hangs 8px into the title padding, so it sits nearer the dialog edge than the
16556
+ // heading does. The bar reserves the rest, which keeps the gap to the heading unchanged.
16557
+ var CLOSE_OFFSET = 8;
16558
+ var CLOSE_RESERVE = 44 - CLOSE_OFFSET;
16559
+
16560
+ // The header is as tall as its heading, with or without a close button.
16561
+ var StyledDialogTitleBar = styled__default["default"].div.withConfig({
16562
+ displayName: "Styles__StyledDialogTitleBar",
16563
+ componentId: "sc-jwpvgm-3"
16564
+ })(["position:relative;display:flex;align-items:center;padding-right:", "px;"], CLOSE_RESERVE);
16565
+ StyledDialogTitleBar.displayName = "StyledDialogTitleBar";
16566
+ var StyledDialogTitleClose = styled__default["default"].div.withConfig({
16567
+ displayName: "Styles__StyledDialogTitleClose",
16568
+ componentId: "sc-jwpvgm-4"
16569
+ })(["position:absolute;right:-", "px;top:50%;transform:translateY(-50%);line-height:0;"], CLOSE_OFFSET);
16570
+ StyledDialogTitleClose.displayName = "StyledDialogTitleClose";
16571
+ var StyledDialogContent = styled__default["default"].div.withConfig({
16572
+ displayName: "Styles__StyledDialogContent",
16573
+ componentId: "sc-jwpvgm-5"
16574
+ })(["padding:20px 30px;flex:1 1 auto;min-height:0;overflow-y:", ";", " ", ""], function (props) {
16575
+ return props.$scroll ? "auto" : "visible";
16576
+ }, FontStyle, BoxSizingStyle);
16577
+ StyledDialogContent.displayName = "StyledDialogContent";
16578
+ var StyledDialogContentDivider = styled__default["default"].div.withConfig({
16579
+ displayName: "Styles__StyledDialogContentDivider",
16580
+ componentId: "sc-jwpvgm-6"
16581
+ })(["border-top:1px solid var(--border-primary);height:1px;flex:0 0 auto;"]);
16582
+ StyledDialogContentDivider.displayName = "StyledDialogContentDivider";
16583
+ var StyledDialogActions = styled__default["default"].div.withConfig({
16584
+ displayName: "Styles__StyledDialogActions",
16585
+ componentId: "sc-jwpvgm-7"
16586
+ })(["padding:20px 30px;flex:0 0 auto;display:flex;align-items:center;gap:12px;", " ", ""], FontStyle, BoxSizingStyle);
16587
+ StyledDialogActions.displayName = "StyledDialogActions";
16588
+
16589
+ var _excluded$1q = ["className", "children"];
16590
+ var DialogActions = function DialogActions(_ref) {
16591
+ var className = _ref.className,
16592
+ children = _ref.children,
16593
+ rest = _objectWithoutProperties(_ref, _excluded$1q);
16594
+ var dialog = useDialogContext();
16595
+
16596
+ // A footer button that does nothing but close gets the same path as clicking the overlay, so the
16597
+ // exit transition runs before the caller unmounts the dialog. Matching on identity leaves a
16598
+ // button that does anything else alone.
16599
+ var wired = dialog !== null && dialog !== void 0 && dialog.requestClose && dialog !== null && dialog !== void 0 && dialog.onClose ? React.Children.map(children, function (child) {
16600
+ return /*#__PURE__*/React.isValidElement(child) && child.props.onClick === dialog.onClose ? /*#__PURE__*/React.cloneElement(child, {
16601
+ onClick: dialog.requestClose
16602
+ }) : child;
16603
+ }) : children;
16604
+ return /*#__PURE__*/React__default["default"].createElement(StyledDialogActions, _extends({
16605
+ className: classNames__default["default"]("c-dialog-actions", className)
16606
+ }, rest), wired);
16607
+ };
16608
+ DialogActions.displayName = "DialogActions";
16609
+
16610
+ var _excluded$1p = ["className", "children", "scroll"];
16611
+ var DialogContent = function DialogContent(_ref) {
16612
+ var className = _ref.className,
16613
+ children = _ref.children,
16614
+ _ref$scroll = _ref.scroll,
16615
+ scroll = _ref$scroll === void 0 ? true : _ref$scroll,
16616
+ rest = _objectWithoutProperties(_ref, _excluded$1p);
16617
+ return /*#__PURE__*/React__default["default"].createElement(StyledDialogContent, _extends({
16618
+ $scroll: scroll,
16619
+ className: classNames__default["default"]("c-dialog-content", className)
16620
+ }, rest), children);
16548
16621
  };
16549
- SlideLeftRightTransition.displayName = "SlideLeftRightTransition";
16622
+ DialogContent.displayName = "DialogContent";
16550
16623
 
16551
- var ResizeTransition = function ResizeTransition(_ref) {
16552
- var _ref$in = _ref.in,
16553
- inProp = _ref$in === void 0 ? false : _ref$in,
16554
- onEnter = _ref.onEnter,
16555
- onExited = _ref.onExited,
16556
- children = _ref.children,
16557
- style = _ref.style,
16558
- _ref$timeout = _ref.timeout,
16559
- timeout = _ref$timeout === void 0 ? 200 : _ref$timeout;
16560
- var defaultStyle = React.useMemo(function () {
16561
- return {
16562
- transitionProperty: "width, height",
16563
- transitionDuration: "".concat(timeout, "ms"),
16564
- transitionTimingFunction: "ease"
16565
- };
16566
- }, [timeout]);
16567
- return /*#__PURE__*/React__default["default"].createElement(reactTransitionGroup.Transition, {
16568
- appear: true,
16569
- in: inProp,
16570
- timeout: timeout,
16571
- onEnter: onEnter,
16572
- onExited: onExited
16573
- }, function (state) {
16574
- return /*#__PURE__*/React.cloneElement(children, {
16575
- style: _objectSpread2(_objectSpread2(_objectSpread2({
16576
- visibility: state === "exited" && !inProp ? "hidden" : undefined
16577
- }, defaultStyle), style), children.props.style)
16578
- });
16624
+ // import { useDialogContext } from "./DialogContext";
16625
+
16626
+ var DialogContentDivider = function DialogContentDivider(_ref) {
16627
+ var className = _ref.className;
16628
+ // useDialogContext();
16629
+
16630
+ return /*#__PURE__*/React__default["default"].createElement(StyledDialogContentDivider, {
16631
+ className: classNames__default["default"]("c-dialog-content-divider", className)
16579
16632
  });
16580
16633
  };
16581
- ResizeTransition.displayName = "ResizeTransition";
16634
+ DialogContentDivider.displayName = "DialogContentDivider";
16582
16635
 
16583
- var _excluded$1m = ["in", "children", "style", "timeout"];
16584
- var defaultStyle = function defaultStyle(duration) {
16585
- return {
16586
- transition: "all ".concat(duration, "ms ease-in"),
16587
- transform: "scaleX(0)",
16588
- opacity: 0,
16589
- transformOrigin: "left"
16590
- };
16636
+ var _excluded$1o = ["children"];
16637
+ var Header3 = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
16638
+ var children = _ref.children,
16639
+ props = _objectWithoutProperties(_ref, _excluded$1o);
16640
+ return /*#__PURE__*/React__default["default"].createElement(Typography, _extends({
16641
+ weight: "bold",
16642
+ variant: "Header 3",
16643
+ ref: ref
16644
+ }, props), children);
16645
+ });
16646
+ Header3.displayName = "Header3";
16647
+
16648
+ var _excluded$1n = ["children", "className", "disableDefaultHeading", "onClose", "closeLabel"];
16649
+ var DialogTitle = function DialogTitle(_ref) {
16650
+ var _dialog$requestClose;
16651
+ var children = _ref.children,
16652
+ className = _ref.className,
16653
+ _ref$disableDefaultHe = _ref.disableDefaultHeading,
16654
+ disableDefaultHeading = _ref$disableDefaultHe === void 0 ? false : _ref$disableDefaultHe,
16655
+ onClose = _ref.onClose,
16656
+ _ref$closeLabel = _ref.closeLabel,
16657
+ closeLabel = _ref$closeLabel === void 0 ? "Close" : _ref$closeLabel,
16658
+ rest = _objectWithoutProperties(_ref, _excluded$1n);
16659
+ var dialog = useDialogContext();
16660
+ var heading = disableDefaultHeading ? children : /*#__PURE__*/React__default["default"].createElement(Header3, null, children);
16661
+
16662
+ // Closing through the dialog lets the exit transition run; the caller's onClose fires once it
16663
+ // finishes. Falling back keeps a title used outside a dialog working.
16664
+ var handleClose = (_dialog$requestClose = dialog === null || dialog === void 0 ? void 0 : dialog.requestClose) !== null && _dialog$requestClose !== void 0 ? _dialog$requestClose : onClose;
16665
+ return /*#__PURE__*/React__default["default"].createElement(StyledDialogTitle, _extends({
16666
+ className: classNames__default["default"]("c-dialog-title-wrapper", className)
16667
+ }, rest), onClose ? /*#__PURE__*/React__default["default"].createElement(StyledDialogTitleBar, null, heading, /*#__PURE__*/React__default["default"].createElement(StyledDialogTitleClose, null, /*#__PURE__*/React__default["default"].createElement(IconButton, {
16668
+ type: "button",
16669
+ variant: "text gray",
16670
+ "aria-label": closeLabel,
16671
+ onClick: handleClose
16672
+ }, /*#__PURE__*/React__default["default"].createElement(CancelCrossIcon$1, null)))) : heading);
16591
16673
  };
16592
- var transitionStyles$1 = {
16593
- entering: {
16594
- transform: "scaleX(1)",
16595
- opacity: 1
16596
- },
16597
- entered: {
16598
- transform: "scaleX(1)",
16599
- opacity: 1
16600
- },
16601
- exiting: {
16602
- transform: "scaleX(0)",
16603
- opacity: 0
16604
- },
16605
- exited: {
16606
- transform: "scaleX(0)",
16607
- opacity: 0
16674
+ DialogTitle.displayName = "DialogTitle";
16675
+
16676
+ function createChainedFunction() {
16677
+ for (var _len = arguments.length, functions = new Array(_len), _key = 0; _key < _len; _key++) {
16678
+ functions[_key] = arguments[_key];
16608
16679
  }
16680
+ return functions.reduce(function (acc, func) {
16681
+ if (func === null) {
16682
+ return acc;
16683
+ }
16684
+ return function chainedFunction() {
16685
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
16686
+ args[_key2] = arguments[_key2];
16687
+ }
16688
+ acc && acc.apply(this, args);
16689
+ func && func.apply(this, args);
16690
+ };
16691
+ },
16692
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
16693
+ function () {});
16694
+ }
16695
+
16696
+ var _excluded$1m = ["children", "disableFocusLock", "disableScrollLock", "disableBackgroundClick", "disableBackgroundColor", "disableCloseOnEsc", "open", "overlayTimeout", "onClose", "onClickOutside"];
16697
+ var getHasTransition = function getHasTransition(children) {
16698
+ return children.props ? Object.prototype.hasOwnProperty.call(children.props, "in") : false;
16609
16699
  };
16610
- var Reveal = function Reveal(_ref) {
16611
- var _ref$in = _ref.in,
16612
- inProp = _ref$in === void 0 ? false : _ref$in,
16613
- children = _ref.children,
16614
- style = _ref.style,
16615
- _ref$timeout = _ref.timeout,
16616
- timeout = _ref$timeout === void 0 ? 200 : _ref$timeout,
16700
+ var Modal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
16701
+ var children = _ref.children,
16702
+ _ref$disableFocusLock = _ref.disableFocusLock,
16703
+ disableFocusLock = _ref$disableFocusLock === void 0 ? false : _ref$disableFocusLock,
16704
+ _ref$disableScrollLoc = _ref.disableScrollLock,
16705
+ disableScrollLock = _ref$disableScrollLoc === void 0 ? false : _ref$disableScrollLoc,
16706
+ _ref$disableBackgroun = _ref.disableBackgroundClick,
16707
+ disableBackgroundClick = _ref$disableBackgroun === void 0 ? false : _ref$disableBackgroun,
16708
+ _ref$disableBackgroun2 = _ref.disableBackgroundColor,
16709
+ disableBackgroundColor = _ref$disableBackgroun2 === void 0 ? false : _ref$disableBackgroun2,
16710
+ _ref$disableCloseOnEs = _ref.disableCloseOnEsc,
16711
+ disableCloseOnEsc = _ref$disableCloseOnEs === void 0 ? false : _ref$disableCloseOnEs,
16712
+ _ref$open = _ref.open,
16713
+ defaultOpen = _ref$open === void 0 ? false : _ref$open,
16714
+ _ref$overlayTimeout = _ref.overlayTimeout,
16715
+ overlayTimeout = _ref$overlayTimeout === void 0 ? {
16716
+ enter: SLIDE_FROM_TOP_ENTER,
16717
+ exit: SLIDE_FROM_TOP_EXIT
16718
+ } : _ref$overlayTimeout,
16719
+ onClose = _ref.onClose,
16720
+ onClickOutside = _ref.onClickOutside,
16617
16721
  rest = _objectWithoutProperties(_ref, _excluded$1m);
16618
- return /*#__PURE__*/React__default["default"].createElement(reactTransitionGroup.Transition, _extends({
16619
- appear: true,
16620
- in: inProp,
16621
- timeout: timeout
16622
- }, rest), function (state) {
16623
- return /*#__PURE__*/React.cloneElement(children, {
16624
- style: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, defaultStyle(inProp ? timeout : 0)), transitionStyles$1[state]), style), children.props.style)
16625
- });
16626
- });
16627
- };
16628
- Reveal.displayName = "Reveal";
16722
+ var _useState = React.useState(defaultOpen),
16723
+ _useState2 = _slicedToArray(_useState, 2),
16724
+ open = _useState2[0],
16725
+ setOpen = _useState2[1];
16726
+ var _useState3 = React.useState(true),
16727
+ _useState4 = _slicedToArray(_useState3, 2),
16728
+ exited = _useState4[0],
16729
+ setExited = _useState4[1];
16730
+ var innerRef = React.useRef(null);
16731
+ var handleRef = useForkRef(innerRef, ref);
16732
+ var hasTransition = React.useMemo(function () {
16733
+ return getHasTransition(children);
16734
+ }, [children]);
16735
+ React.useEffect(function () {
16736
+ setOpen(defaultOpen);
16737
+ }, [defaultOpen]);
16738
+ var handleClose = React.useCallback(function () {
16739
+ setOpen(false);
16740
+ if (!hasTransition) {
16741
+ typeof onClose === "function" && onClose();
16742
+ }
16743
+ }, [hasTransition, onClose]);
16744
+ var handleBackgroundClick = React.useCallback(function (event) {
16745
+ if (!disableBackgroundClick) {
16746
+ event.preventDefault();
16747
+ return handleClose();
16748
+ }
16749
+ if (onClickOutside) {
16750
+ onClickOutside(event);
16751
+ }
16752
+ }, [disableBackgroundClick, onClickOutside, handleClose]);
16753
+ var handleEnter = React.useCallback(function () {
16754
+ setExited(false);
16755
+ }, []);
16756
+ var handleExited = React.useCallback(function () {
16757
+ setExited(true);
16758
+ typeof onClose === "function" && onClose();
16759
+ }, [onClose]);
16760
+ var childProps = React.useMemo(function () {
16761
+ var props = {};
16629
16762
 
16630
- var transitionStyles = {
16631
- entered: {
16632
- transform: "scale(1)"
16633
- },
16634
- exiting: {
16635
- transform: "scale(0)"
16763
+ // It's a Transition like component
16764
+ if (hasTransition && children) {
16765
+ props = {
16766
+ onEnter: createChainedFunction(handleEnter, children.props.onEnter),
16767
+ onExited: createChainedFunction(handleExited, children.props.onExited),
16768
+ in: open,
16769
+ forceClose: handleClose
16770
+ };
16771
+ }
16772
+ return props;
16773
+ }, [children, handleClose, handleEnter, handleExited, hasTransition, open]);
16774
+ if (!open && (!hasTransition || exited)) {
16775
+ return null;
16636
16776
  }
16637
- };
16638
- var Scale = function Scale(_ref) {
16639
- var _ref$in = _ref.in,
16640
- inProp = _ref$in === void 0 ? false : _ref$in,
16641
- onEnter = _ref.onEnter,
16642
- onExited = _ref.onExited,
16643
- children = _ref.children,
16644
- style = _ref.style,
16645
- _ref$timeout = _ref.timeout,
16646
- timeout = _ref$timeout === void 0 ? 200 : _ref$timeout;
16647
- var defaultStyle = React.useMemo(function () {
16648
- return {
16649
- transitionProperty: "transform",
16650
- transitionDuration: "".concat(timeout, "ms"),
16651
- transform: "scale(0)"
16652
- };
16653
- }, [timeout]);
16654
- return /*#__PURE__*/React__default["default"].createElement(reactTransitionGroup.Transition, {
16655
- in: inProp,
16656
- timeout: timeout,
16657
- onEnter: onEnter,
16658
- onExited: onExited
16659
- }, function (state) {
16660
- return /*#__PURE__*/React.cloneElement(children, {
16661
- style: _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, defaultStyle), transitionStyles[state]), style), children.props.style)
16662
- });
16663
- });
16664
- };
16665
- Scale.displayName = "Scale";
16777
+ return /*#__PURE__*/React__default["default"].createElement(Window, _extends({}, rest, {
16778
+ ref: handleRef,
16779
+ onClose: handleClose,
16780
+ disableFocusLock: disableFocusLock,
16781
+ disableScrollLock: disableScrollLock,
16782
+ disableCloseOnEsc: disableCloseOnEsc
16783
+ }), /*#__PURE__*/React__default["default"].createElement(Fade, {
16784
+ in: open,
16785
+ timeout: open ? overlayTimeout.enter : overlayTimeout.exit
16786
+ }, /*#__PURE__*/React__default["default"].createElement(Overlay, {
16787
+ onClick: handleBackgroundClick,
16788
+ disableBackgroundColor: disableBackgroundColor,
16789
+ style: {
16790
+ pointerEvents: open ? undefined : "none"
16791
+ }
16792
+ })), /*#__PURE__*/React.cloneElement(children, childProps));
16793
+ });
16794
+ Modal.displayName = "Modal";
16666
16795
 
16667
16796
  var _excluded$1l = ["children", "open", "onClose", "className", "enableBackgroundClick", "disableCloseOnEsc", "animate", "onClickOutside", "size", "height"];
16668
16797
  // Modal only treats a child as a transition when its props already carry `in`, so this element
@@ -16719,7 +16848,14 @@
16719
16848
  onClose: onClose,
16720
16849
  disableBackgroundClick: !enableBackgroundClick,
16721
16850
  disableCloseOnEsc: disableCloseOnEsc,
16722
- onClickOutside: onClickOutside
16851
+ onClickOutside: onClickOutside,
16852
+ overlayTimeout: animate === "fade" ? {
16853
+ enter: FADE_DURATION,
16854
+ exit: FADE_DURATION
16855
+ } : {
16856
+ enter: SLIDE_FROM_TOP_ENTER,
16857
+ exit: SLIDE_FROM_TOP_EXIT
16858
+ }
16723
16859
  }, rest), /*#__PURE__*/React__default["default"].createElement(DialogSurface, {
16724
16860
  in: open,
16725
16861
  onClose: onClose,
@@ -31342,6 +31478,7 @@
31342
31478
  exports.EyeOffIcon = EyeOffIcon$1;
31343
31479
  exports.EyeOffSmallIcon = EyeOffSmallIcon$1;
31344
31480
  exports.EyeSmallIcon = EyeSmallIcon$1;
31481
+ exports.FADE_DURATION = FADE_DURATION;
31345
31482
  exports.FLEX_ALIGN = FLEX_ALIGN;
31346
31483
  exports.Fade = Fade;
31347
31484
  exports.Filter = Filter;
@@ -31351,6 +31488,8 @@
31351
31488
  exports.FolderOutlineIcon = FolderOutlineIcon$1;
31352
31489
  exports.FolderPlusIcon = FolderPlusIcon$1;
31353
31490
  exports.FromElement = FromElement;
31491
+ exports.GROW_ENTER = GROW_ENTER;
31492
+ exports.GROW_EXIT = GROW_EXIT;
31354
31493
  exports.GearFailedIcon = GearFailedIcon$1;
31355
31494
  exports.GearIcon = GearIcon$1;
31356
31495
  exports.GiftIcon = GiftIcon$1;
@@ -31368,6 +31507,7 @@
31368
31507
  exports.GlobalAddButton = GlobalAddButton;
31369
31508
  exports.GlobalStyle = GlobalStyle;
31370
31509
  exports.GroupByIcon = GroupByIcon$1;
31510
+ exports.Grow = Grow;
31371
31511
  exports.HashIcon = HashIcon$1;
31372
31512
  exports.HashtagIcon = HashtagIcon$1;
31373
31513
  exports.Header = Header;
@@ -31519,6 +31659,8 @@
31519
31659
  exports.RoundedRectangleIcon = RoundedRectangleIcon$1;
31520
31660
  exports.Row = Row;
31521
31661
  exports.SHIFT_STEP_MULTIPLIER = SHIFT_STEP_MULTIPLIER;
31662
+ exports.SLIDE_FROM_TOP_ENTER = SLIDE_FROM_TOP_ENTER;
31663
+ exports.SLIDE_FROM_TOP_EXIT = SLIDE_FROM_TOP_EXIT;
31522
31664
  exports.SPACE = SPACE;
31523
31665
  exports.SPINE_STEP = SPINE_STEP;
31524
31666
  exports.STACKED_CARD_CONTROL_CLASS = STACKED_CARD_CONTROL_CLASS;