@shoplflow/base 0.24.15 → 0.24.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +78 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +80 -27
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -644,6 +644,16 @@ var getModalBodyTopBottomPadding = (isIncludeHeader) => {
|
|
|
644
644
|
padding-bottom: 24px;
|
|
645
645
|
`;
|
|
646
646
|
};
|
|
647
|
+
var checkMaxHeight = (height, viewport) => {
|
|
648
|
+
const topBottomMargin = 64;
|
|
649
|
+
if (height > 1200) {
|
|
650
|
+
return 1200 - topBottomMargin;
|
|
651
|
+
}
|
|
652
|
+
if (height > viewport) {
|
|
653
|
+
return viewport - topBottomMargin;
|
|
654
|
+
}
|
|
655
|
+
return height - topBottomMargin;
|
|
656
|
+
};
|
|
647
657
|
var Container = styled5__default.default.div`
|
|
648
658
|
display: flex;
|
|
649
659
|
flex-direction: column;
|
|
@@ -652,7 +662,7 @@ var Container = styled5__default.default.div`
|
|
|
652
662
|
box-shadow: ${exports.boxShadowTokens.dropShadow};
|
|
653
663
|
overflow: hidden;
|
|
654
664
|
flex-grow: 1;
|
|
655
|
-
height: ${({ height }) => height ? `${height}px` : "initial"};
|
|
665
|
+
height: ${({ height, viewport }) => height ? `${checkMaxHeight(height, viewport)}px` : "initial"};
|
|
656
666
|
min-height: 180px;
|
|
657
667
|
max-height: 1200px;
|
|
658
668
|
width: ${({ sizeVar }) => getModalWidthFromSize(sizeVar)}px;
|
|
@@ -674,8 +684,9 @@ var BodyContainer = styled5__default.default.div`
|
|
|
674
684
|
overflow: hidden;
|
|
675
685
|
flex-direction: column;
|
|
676
686
|
background: ${exports.colorTokens.neutral0};
|
|
677
|
-
|
|
678
|
-
min-height: ${({
|
|
687
|
+
box-sizing: border-box;
|
|
688
|
+
min-height: ${({ minHeight }) => minHeight};
|
|
689
|
+
max-height: ${({ maxHeight }) => maxHeight}px;
|
|
679
690
|
flex: 1;
|
|
680
691
|
${({ isIncludeHeader }) => getModalBodyTopBottomPadding(isIncludeHeader)}
|
|
681
692
|
`;
|
|
@@ -685,7 +696,7 @@ var ModalBodyContainerInner = styled5__default.default.div`
|
|
|
685
696
|
flex-direction: column;
|
|
686
697
|
flex-grow: 1;
|
|
687
698
|
//스크롤 생성시 하단 padding 적용하기 위한 설정
|
|
688
|
-
height:
|
|
699
|
+
height: 100%;
|
|
689
700
|
box-sizing: border-box;
|
|
690
701
|
`;
|
|
691
702
|
var ModalBodyContent = styled5__default.default.div`
|
|
@@ -720,9 +731,23 @@ exports.ModalSize = {
|
|
|
720
731
|
};
|
|
721
732
|
exports.MODAL_HEADER_KEY = Symbol("MODAL_HEADER");
|
|
722
733
|
exports.MODAL_FOOTER_KEY = Symbol("MODAL_FOOTER");
|
|
734
|
+
var useViewportSizeObserver = () => {
|
|
735
|
+
const [size2, setSize] = React2.useState({ width: window.innerWidth, height: window.innerHeight });
|
|
736
|
+
React2.useEffect(() => {
|
|
737
|
+
const handleResize = () => {
|
|
738
|
+
setSize({ width: window.innerWidth, height: window.innerHeight });
|
|
739
|
+
};
|
|
740
|
+
window.addEventListener("resize", handleResize);
|
|
741
|
+
return () => window.removeEventListener("resize", handleResize);
|
|
742
|
+
}, []);
|
|
743
|
+
return size2;
|
|
744
|
+
};
|
|
723
745
|
var ModalContainer = (_a) => {
|
|
724
|
-
var _b = _a, { children, outsideClick = utils.noop } = _b, rest = __objRest(_b, ["children", "outsideClick"]);
|
|
746
|
+
var _b = _a, { children, height, outsideClick = utils.noop } = _b, rest = __objRest(_b, ["children", "height", "outsideClick"]);
|
|
725
747
|
const ref = utils.useParentElementClick(outsideClick);
|
|
748
|
+
const { height: windowHeight } = useViewportSizeObserver();
|
|
749
|
+
const topBottomMargin = 64;
|
|
750
|
+
const heightWidthMargin = height ? height + topBottomMargin : void 0;
|
|
726
751
|
const childrenArray = React2__namespace.default.Children.toArray(children);
|
|
727
752
|
const findHeader = childrenArray.find((child) => {
|
|
728
753
|
if (!React2__namespace.default.isValidElement(child)) {
|
|
@@ -748,10 +773,10 @@ var ModalContainer = (_a) => {
|
|
|
748
773
|
isIncludeHeader: Boolean(findHeader),
|
|
749
774
|
isIncludeFooter: Boolean(findFooter),
|
|
750
775
|
sizeVar: rest.sizeVar,
|
|
751
|
-
height:
|
|
776
|
+
height: heightWidthMargin
|
|
752
777
|
});
|
|
753
778
|
});
|
|
754
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Container, __spreadProps(__spreadValues({ ref }, rest), { "data-shoplflow": "Modal", children: addPropInChildren }));
|
|
779
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Container, __spreadProps(__spreadValues({ ref }, rest), { height: heightWidthMargin, viewport: windowHeight, "data-shoplflow": "Modal", children: addPropInChildren }));
|
|
755
780
|
};
|
|
756
781
|
var ModalContainer_default = ModalContainer;
|
|
757
782
|
var ModalFooter = ({ children }) => {
|
|
@@ -771,9 +796,7 @@ var ModalBody = ({
|
|
|
771
796
|
sizeVar,
|
|
772
797
|
height: modalContainerHeight
|
|
773
798
|
}) => {
|
|
774
|
-
const { height: windowHeight } =
|
|
775
|
-
trackHeight: true
|
|
776
|
-
});
|
|
799
|
+
const { height: windowHeight } = useViewportSizeObserver();
|
|
777
800
|
const headerHeight = 64;
|
|
778
801
|
const footerHeight = 64;
|
|
779
802
|
const topBottomMargin = 64;
|
|
@@ -790,21 +813,44 @@ var ModalBody = ({
|
|
|
790
813
|
const headerFooterHeight = React2.useMemo(() => getHeaderFooterHeight(), [getHeaderFooterHeight]);
|
|
791
814
|
const setAutoHeightMin = () => {
|
|
792
815
|
if (modalContainerHeight) {
|
|
793
|
-
|
|
816
|
+
if (modalContainerHeight <= 1200) {
|
|
817
|
+
if (windowHeight < modalContainerHeight) {
|
|
818
|
+
return windowHeight - topBottomMargin - headerFooterHeight;
|
|
819
|
+
}
|
|
820
|
+
return 1200 - topBottomMargin - headerFooterHeight;
|
|
821
|
+
}
|
|
822
|
+
return modalContainerHeight - topBottomMargin - headerFooterHeight;
|
|
794
823
|
} else {
|
|
795
824
|
return "100%";
|
|
796
825
|
}
|
|
797
826
|
};
|
|
798
|
-
const
|
|
799
|
-
|
|
800
|
-
|
|
827
|
+
const setAutoHeightMax = () => {
|
|
828
|
+
if (modalContainerHeight) {
|
|
829
|
+
if (modalContainerHeight > 1200) {
|
|
830
|
+
return 1200 - topBottomMargin - headerFooterHeight;
|
|
831
|
+
}
|
|
832
|
+
if (modalContainerHeight <= 1200) {
|
|
833
|
+
if (windowHeight < modalContainerHeight) {
|
|
834
|
+
return windowHeight - topBottomMargin - headerFooterHeight;
|
|
835
|
+
}
|
|
836
|
+
return modalContainerHeight - topBottomMargin - headerFooterHeight;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
if (!modalContainerHeight) {
|
|
840
|
+
const heightUnderMaxHeight = windowHeight - topBottomMargin - headerFooterHeight;
|
|
841
|
+
const heightOverMaxHeight = 1200 - topBottomMargin - headerFooterHeight;
|
|
842
|
+
return windowHeight > 1200 ? heightOverMaxHeight : heightUnderMaxHeight;
|
|
843
|
+
}
|
|
844
|
+
return "100%";
|
|
845
|
+
};
|
|
846
|
+
return /* @__PURE__ */ jsxRuntime.jsx(BodyContainer, { isIncludeHeader, minHeight: setAutoHeightMin(), maxHeight: setAutoHeightMax(), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
801
847
|
exports.ScrollArea,
|
|
802
848
|
{
|
|
803
849
|
id: `scrollbar`,
|
|
804
850
|
universal: true,
|
|
805
851
|
autoHeight: !modalContainerHeight,
|
|
806
852
|
autoHeightMin: setAutoHeightMin(),
|
|
807
|
-
autoHeightMax:
|
|
853
|
+
autoHeightMax: setAutoHeightMax(),
|
|
808
854
|
style: {
|
|
809
855
|
height: "100%",
|
|
810
856
|
overflow: "hidden"
|
|
@@ -1147,19 +1193,19 @@ var getNextColor = (color, step = 1) => {
|
|
|
1147
1193
|
};
|
|
1148
1194
|
const sortColorToken = findColorToken.sort((a, b) => extractNumbers(a) - extractNumbers(b));
|
|
1149
1195
|
const currentIndex = sortColorToken.indexOf(color);
|
|
1150
|
-
let newIndex = currentIndex
|
|
1151
|
-
let
|
|
1152
|
-
while (
|
|
1196
|
+
let newIndex = currentIndex;
|
|
1197
|
+
let stepCount = 0;
|
|
1198
|
+
while (stepCount < Math.abs(step)) {
|
|
1153
1199
|
newIndex += Math.sign(step);
|
|
1154
|
-
if (newIndex < 0) {
|
|
1155
|
-
|
|
1200
|
+
if (newIndex < 0 || newIndex >= sortColorToken.length) {
|
|
1201
|
+
break;
|
|
1156
1202
|
}
|
|
1157
|
-
if (newIndex
|
|
1158
|
-
|
|
1203
|
+
if (!sortColorToken[newIndex].endsWith("_5") && !sortColorToken[newIndex].includes("50")) {
|
|
1204
|
+
stepCount++;
|
|
1159
1205
|
}
|
|
1160
|
-
potentialToken = sortColorToken[newIndex];
|
|
1161
1206
|
}
|
|
1162
|
-
|
|
1207
|
+
newIndex = Math.max(0, Math.min(newIndex, sortColorToken.length - 1));
|
|
1208
|
+
return sortColorToken[newIndex];
|
|
1163
1209
|
};
|
|
1164
1210
|
|
|
1165
1211
|
// src/components/Chips/ChipButton/ChipButton.styled.ts
|
|
@@ -1559,7 +1605,9 @@ var StyledCallout = styled5__default.default.div`
|
|
|
1559
1605
|
`;
|
|
1560
1606
|
var StyledCalloutIcon = styled5__default.default.svg`
|
|
1561
1607
|
display: flex;
|
|
1608
|
+
height: 20px;
|
|
1562
1609
|
min-height: 20px;
|
|
1610
|
+
width: 20px;
|
|
1563
1611
|
min-width: 20px;
|
|
1564
1612
|
`;
|
|
1565
1613
|
styled5__default.default.div`
|
|
@@ -2799,6 +2847,7 @@ var InputButton = React2.forwardRef(
|
|
|
2799
2847
|
var _b = _a, { value, defaultValue, onChange, onClick, isSelected, disabled = false, rightSource, onClear, width } = _b, rest = __objRest(_b, ["value", "defaultValue", "onChange", "onClick", "isSelected", "disabled", "rightSource", "onClear", "width"]);
|
|
2800
2848
|
const [text, setText] = React2.useState("");
|
|
2801
2849
|
const [isHovered, setIsHovered] = React2.useState(false);
|
|
2850
|
+
const prevValue = React2.useRef(value);
|
|
2802
2851
|
const convertToString = React2.useCallback((value2) => {
|
|
2803
2852
|
if (typeof value2 !== "number") {
|
|
2804
2853
|
return typeof value2 === "string" ? value2 : value2.join("");
|
|
@@ -2831,9 +2880,13 @@ var InputButton = React2.forwardRef(
|
|
|
2831
2880
|
}
|
|
2832
2881
|
}, [convertToString, defaultValue]);
|
|
2833
2882
|
React2.useEffect(() => {
|
|
2834
|
-
if (value) {
|
|
2883
|
+
if (!(value === void 0 || value === null)) {
|
|
2884
|
+
if (prevValue.current === value) {
|
|
2885
|
+
return;
|
|
2886
|
+
}
|
|
2835
2887
|
const convertString = convertToString(value);
|
|
2836
2888
|
setText(convertString);
|
|
2889
|
+
prevValue.current = convertString;
|
|
2837
2890
|
}
|
|
2838
2891
|
}, [convertToString, value]);
|
|
2839
2892
|
React2.useEffect(() => {
|