glints-aries 4.0.281 → 4.0.282

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.
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
3
  var _excluded = ["isOpen", "header", "headerDescription", "children", "secondaryAction", "primaryAction", "customActions", "showBackButton", "showCloseButton", "showHeaderBorder", "closeOnClickOutside", "onClose", "onBack", "zIndexOverride"];
4
- import React, { useEffect } from 'react';
4
+ import React, { useEffect, useRef, useState } from 'react';
5
5
  import { Button, PrimaryButton } from '../Button';
6
6
  import { ButtonGroup } from '../ButtonGroup';
7
7
  import { Icon } from '../Icon';
@@ -27,6 +27,26 @@ export var Modal = /*#__PURE__*/React.forwardRef(function Modal(_ref, ref) {
27
27
  _ref$zIndexOverride = _ref.zIndexOverride,
28
28
  zIndexOverride = _ref$zIndexOverride === void 0 ? 999 : _ref$zIndexOverride,
29
29
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
30
+ var _useState = useState(false),
31
+ isContentHasScrollbar = _useState[0],
32
+ setIsContentHasScrollbar = _useState[1];
33
+ var modalContentRef = useRef(null);
34
+ useEffect(function () {
35
+ var checkScrollbar = function checkScrollbar() {
36
+ var modalContent = modalContentRef.current;
37
+ if (modalContent) {
38
+ setIsContentHasScrollbar(modalContent.scrollHeight > modalContent.clientHeight);
39
+ }
40
+ };
41
+ checkScrollbar();
42
+ var handleResize = function handleResize() {
43
+ return checkScrollbar();
44
+ };
45
+ window.addEventListener('resize', handleResize);
46
+ return function () {
47
+ window.removeEventListener('resize', handleResize);
48
+ };
49
+ });
30
50
  useEffect(function () {
31
51
  if (typeof window === 'undefined' || !window.document) return;
32
52
  var enableScroll = function enableScroll() {
@@ -100,6 +120,8 @@ export var Modal = /*#__PURE__*/React.forwardRef(function Modal(_ref, ref) {
100
120
  }, /*#__PURE__*/React.createElement(Icon, {
101
121
  name: "ri-close"
102
122
  })))), /*#__PURE__*/React.createElement(StyledModalContent, {
103
- className: "modal-content"
123
+ className: "modal-content",
124
+ ref: modalContentRef,
125
+ "data-has-scrollbar": isContentHasScrollbar
104
126
  }, content), hasActions && /*#__PURE__*/React.createElement(StyledModalActions, null, actionsContent))));
105
127
  });
@@ -12,7 +12,7 @@ export var StyledModalWrapper = styled.div.withConfig({
12
12
  export var StyledModalContainer = styled.div.withConfig({
13
13
  displayName: "ModalStyle__StyledModalContainer",
14
14
  componentId: "sc-1694up4-1"
15
- })(["position:relative;background:", ";display:flex;flex-direction:column;justify-content:space-between;align-items:flex-start;padding:0;box-shadow:0px 26px 80px rgba(0,0,0,0.2),0px 0px 1px rgba(0,0,0,0.2);border-radius:", ";min-width:320px;width:fit-content;max-width:calc(100vw - 32px);height:fit-content;max-height:calc(100vh - 96px);overflow:hidden;"], Neutral.B100, borderRadius8);
15
+ })(["position:relative;background:", ";display:flex;flex-direction:column;justify-content:space-between;align-items:flex-start;padding:0;box-shadow:0px 26px 80px rgba(0,0,0,0.2),0px 0px 1px rgba(0,0,0,0.2);border-radius:", ";min-width:320px;width:fit-content;max-width:calc(100vw - 32px);height:fit-content;max-height:calc(100vh - 96px);overflow:hidden;@media (max-width:", "){position:fixed;bottom:0;width:100vw;max-width:none;max-height:calc(100vh - 70px);border-radius:0;}"], Neutral.B100, borderRadius8, Breakpoints.large);
16
16
  export var StyledModalHeader = styled.div.withConfig({
17
17
  displayName: "ModalStyle__StyledModalHeader",
18
18
  componentId: "sc-1694up4-2"
@@ -20,7 +20,7 @@ export var StyledModalHeader = styled.div.withConfig({
20
20
  export var StyledModalContent = styled.div.withConfig({
21
21
  displayName: "ModalStyle__StyledModalContent",
22
22
  componentId: "sc-1694up4-3"
23
- })(["min-height:24px;color:#202223;width:fit-content;padding:20px;overflow:auto;@media (max-width:", "){padding:20px ", ";}"], Breakpoints.large, space16);
23
+ })(["min-height:24px;color:#202223;width:fit-content;padding:20px;overflow:auto;::-webkit-scrollbar{width:4px;}::-webkit-scrollbar-thumb{background-color:", ";border-radius:2px;}::-webkit-scrollbar-thumb:hover{background-color:", ";}@media (max-width:", "){padding:20px 16px;&[data-has-scrollbar='true']{padding:20px 6px 20px 16px;width:calc(100vw - 27px);}}"], Neutral.B68, Neutral.B40, Breakpoints.large);
24
24
  export var StyledModalActions = styled.div.withConfig({
25
25
  displayName: "ModalStyle__StyledModalActions",
26
26
  componentId: "sc-1694up4-4"
@@ -34,6 +34,26 @@ var Modal = /*#__PURE__*/_react["default"].forwardRef(function Modal(_ref, ref)
34
34
  _ref$zIndexOverride = _ref.zIndexOverride,
35
35
  zIndexOverride = _ref$zIndexOverride === void 0 ? 999 : _ref$zIndexOverride,
36
36
  props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
37
+ var _useState = (0, _react.useState)(false),
38
+ isContentHasScrollbar = _useState[0],
39
+ setIsContentHasScrollbar = _useState[1];
40
+ var modalContentRef = (0, _react.useRef)(null);
41
+ (0, _react.useEffect)(function () {
42
+ var checkScrollbar = function checkScrollbar() {
43
+ var modalContent = modalContentRef.current;
44
+ if (modalContent) {
45
+ setIsContentHasScrollbar(modalContent.scrollHeight > modalContent.clientHeight);
46
+ }
47
+ };
48
+ checkScrollbar();
49
+ var handleResize = function handleResize() {
50
+ return checkScrollbar();
51
+ };
52
+ window.addEventListener('resize', handleResize);
53
+ return function () {
54
+ window.removeEventListener('resize', handleResize);
55
+ };
56
+ });
37
57
  (0, _react.useEffect)(function () {
38
58
  if (typeof window === 'undefined' || !window.document) return;
39
59
  var enableScroll = function enableScroll() {
@@ -107,7 +127,9 @@ var Modal = /*#__PURE__*/_react["default"].forwardRef(function Modal(_ref, ref)
107
127
  }, /*#__PURE__*/_react["default"].createElement(_Icon.Icon, {
108
128
  name: "ri-close"
109
129
  })))), /*#__PURE__*/_react["default"].createElement(_ModalStyle.StyledModalContent, {
110
- className: "modal-content"
130
+ className: "modal-content",
131
+ ref: modalContentRef,
132
+ "data-has-scrollbar": isContentHasScrollbar
111
133
  }, content), hasActions && /*#__PURE__*/_react["default"].createElement(_ModalStyle.StyledModalActions, null, actionsContent))));
112
134
  });
113
135
  exports.Modal = Modal;
@@ -20,7 +20,7 @@ exports.StyledModalWrapper = StyledModalWrapper;
20
20
  var StyledModalContainer = _styledComponents["default"].div.withConfig({
21
21
  displayName: "ModalStyle__StyledModalContainer",
22
22
  componentId: "sc-1694up4-1"
23
- })(["position:relative;background:", ";display:flex;flex-direction:column;justify-content:space-between;align-items:flex-start;padding:0;box-shadow:0px 26px 80px rgba(0,0,0,0.2),0px 0px 1px rgba(0,0,0,0.2);border-radius:", ";min-width:320px;width:fit-content;max-width:calc(100vw - 32px);height:fit-content;max-height:calc(100vh - 96px);overflow:hidden;"], _colors.Neutral.B100, _borderRadius.borderRadius8);
23
+ })(["position:relative;background:", ";display:flex;flex-direction:column;justify-content:space-between;align-items:flex-start;padding:0;box-shadow:0px 26px 80px rgba(0,0,0,0.2),0px 0px 1px rgba(0,0,0,0.2);border-radius:", ";min-width:320px;width:fit-content;max-width:calc(100vw - 32px);height:fit-content;max-height:calc(100vh - 96px);overflow:hidden;@media (max-width:", "){position:fixed;bottom:0;width:100vw;max-width:none;max-height:calc(100vh - 70px);border-radius:0;}"], _colors.Neutral.B100, _borderRadius.borderRadius8, Breakpoints.large);
24
24
  exports.StyledModalContainer = StyledModalContainer;
25
25
  var StyledModalHeader = _styledComponents["default"].div.withConfig({
26
26
  displayName: "ModalStyle__StyledModalHeader",
@@ -30,7 +30,7 @@ exports.StyledModalHeader = StyledModalHeader;
30
30
  var StyledModalContent = _styledComponents["default"].div.withConfig({
31
31
  displayName: "ModalStyle__StyledModalContent",
32
32
  componentId: "sc-1694up4-3"
33
- })(["min-height:24px;color:#202223;width:fit-content;padding:20px;overflow:auto;@media (max-width:", "){padding:20px ", ";}"], Breakpoints.large, _spacing.space16);
33
+ })(["min-height:24px;color:#202223;width:fit-content;padding:20px;overflow:auto;::-webkit-scrollbar{width:4px;}::-webkit-scrollbar-thumb{background-color:", ";border-radius:2px;}::-webkit-scrollbar-thumb:hover{background-color:", ";}@media (max-width:", "){padding:20px 16px;&[data-has-scrollbar='true']{padding:20px 6px 20px 16px;width:calc(100vw - 27px);}}"], _colors.Neutral.B68, _colors.Neutral.B40, Breakpoints.large);
34
34
  exports.StyledModalContent = StyledModalContent;
35
35
  var StyledModalActions = _styledComponents["default"].div.withConfig({
36
36
  displayName: "ModalStyle__StyledModalActions",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glints-aries",
3
- "version": "4.0.281",
3
+ "version": "4.0.282",
4
4
  "description": "Glints ui-kit for frontend",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./es/index.js",