@shoplflow/base 0.14.0 → 0.15.0
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 +123 -93
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -11
- package/dist/index.d.ts +12 -11
- package/dist/index.js +50 -48
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -6,10 +6,10 @@ var framerMotion = require('framer-motion');
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var reactDom$1 = require('react-dom');
|
|
8
8
|
var utils = require('@shoplflow/utils');
|
|
9
|
-
var react = require('@emotion/react');
|
|
9
|
+
var react$1 = require('@emotion/react');
|
|
10
10
|
var Scrollbars = require('react-custom-scrollbars-2');
|
|
11
|
+
var react = require('@floating-ui/react');
|
|
11
12
|
var reactDom = require('@floating-ui/react-dom');
|
|
12
|
-
var react$1 = require('@floating-ui/react');
|
|
13
13
|
var ShoplAssets = require('@shoplflow/shopl-assets');
|
|
14
14
|
var HadaAssets = require('@shoplflow/hada-assets');
|
|
15
15
|
|
|
@@ -506,7 +506,7 @@ exports.MotionStack.Vertical = framerMotion.motion(Stack.Vertical);
|
|
|
506
506
|
exports.MotionStack.Horizontal = framerMotion.motion(Stack.Horizontal);
|
|
507
507
|
exports.Stack = Stack;
|
|
508
508
|
var setEllipsis = (maxLines) => {
|
|
509
|
-
return react.css`
|
|
509
|
+
return react$1.css`
|
|
510
510
|
display: -webkit-box;
|
|
511
511
|
line-clamp: ${maxLines};
|
|
512
512
|
-webkit-line-clamp: ${maxLines};
|
|
@@ -522,13 +522,13 @@ var StyledText = styled5__default.default.span`
|
|
|
522
522
|
${({ lineClamp }) => lineClamp && setEllipsis(lineClamp)};
|
|
523
523
|
text-align: ${({ textAlign }) => textAlign && textAlign};
|
|
524
524
|
white-space: ${({ whiteSpace }) => whiteSpace && whiteSpace};
|
|
525
|
-
${({ textDecorations }) => textDecorations && react.css`
|
|
525
|
+
${({ textDecorations }) => textDecorations && react$1.css`
|
|
526
526
|
text-decoration: ${textDecorations};
|
|
527
527
|
`};
|
|
528
|
-
${({ opacity }) => opacity && react.css`
|
|
528
|
+
${({ opacity }) => opacity && react$1.css`
|
|
529
529
|
opacity: ${opacity};
|
|
530
530
|
`}
|
|
531
|
-
${({ wordBreak }) => wordBreak && react.css`
|
|
531
|
+
${({ wordBreak }) => wordBreak && react$1.css`
|
|
532
532
|
word-break: ${wordBreak};
|
|
533
533
|
`};
|
|
534
534
|
`;
|
|
@@ -578,8 +578,8 @@ var MODAL_SIZE_M = 640;
|
|
|
578
578
|
var MODAL_SIZE_L = 768;
|
|
579
579
|
var MODAL_SIZE_XL = 1040;
|
|
580
580
|
var MODAL_SIZE_XXL = 1280;
|
|
581
|
-
var getModalWidthFromSize = (
|
|
582
|
-
switch (
|
|
581
|
+
var getModalWidthFromSize = (size2) => {
|
|
582
|
+
switch (size2) {
|
|
583
583
|
case "XXS":
|
|
584
584
|
return MODAL_SIZE_XXS;
|
|
585
585
|
case "XS":
|
|
@@ -600,12 +600,12 @@ var getModalWidthFromSize = (size) => {
|
|
|
600
600
|
};
|
|
601
601
|
var getModalBodyTopBottomPadding = (isIncludeHeader) => {
|
|
602
602
|
if (isIncludeHeader) {
|
|
603
|
-
return react.css`
|
|
603
|
+
return react$1.css`
|
|
604
604
|
padding-top: 16px;
|
|
605
605
|
padding-bottom: 24px;
|
|
606
606
|
`;
|
|
607
607
|
}
|
|
608
|
-
return react.css`
|
|
608
|
+
return react$1.css`
|
|
609
609
|
padding-top: 24px;
|
|
610
610
|
padding-bottom: 24px;
|
|
611
611
|
`;
|
|
@@ -910,7 +910,7 @@ var getDisabledStyle = (disabled) => {
|
|
|
910
910
|
if (!disabled) {
|
|
911
911
|
return;
|
|
912
912
|
}
|
|
913
|
-
return react.css`
|
|
913
|
+
return react$1.css`
|
|
914
914
|
opacity: 50%;
|
|
915
915
|
cursor: not-allowed !important;
|
|
916
916
|
`;
|
|
@@ -927,7 +927,7 @@ var getLineTypographyBySizeVar = (sizeVar) => {
|
|
|
927
927
|
return "body2_400";
|
|
928
928
|
}
|
|
929
929
|
};
|
|
930
|
-
var solidStyle = ({ isSelected, color, radius }) => react.css`
|
|
930
|
+
var solidStyle = ({ isSelected, color, radius }) => react$1.css`
|
|
931
931
|
padding: 7px 12px;
|
|
932
932
|
gap: 4px;
|
|
933
933
|
background: ${exports.colorTokens.neutral150};
|
|
@@ -939,10 +939,10 @@ var solidStyle = ({ isSelected, color, radius }) => react.css`
|
|
|
939
939
|
background: ${exports.colorTokens.neutral200};
|
|
940
940
|
}
|
|
941
941
|
|
|
942
|
-
${radius && react.css`
|
|
942
|
+
${radius && react$1.css`
|
|
943
943
|
border-radius: ${exports.borderRadiusTokens.borderRadius16};
|
|
944
944
|
`};
|
|
945
|
-
${isSelected && react.css`
|
|
945
|
+
${isSelected && react$1.css`
|
|
946
946
|
background: ${exports.colorTokens[color]};
|
|
947
947
|
& > span {
|
|
948
948
|
color: ${exports.colorTokens["neutral0"]};
|
|
@@ -1037,7 +1037,7 @@ var getLineTypographyBySizeVar2 = (sizeVar) => {
|
|
|
1037
1037
|
return "body3_400";
|
|
1038
1038
|
}
|
|
1039
1039
|
};
|
|
1040
|
-
var lineStyle = ({ color }) => react.css`
|
|
1040
|
+
var lineStyle = ({ color }) => react$1.css`
|
|
1041
1041
|
background: ${exports.colorTokens.neutral0};
|
|
1042
1042
|
border: 1px solid ${exports.colorTokens[color]};
|
|
1043
1043
|
border-radius: ${exports.borderRadiusTokens.borderRadius20};
|
|
@@ -1051,15 +1051,15 @@ var lineStyle = ({ color }) => react.css`
|
|
|
1051
1051
|
var getStyleBySizeVar = (sizeVar) => {
|
|
1052
1052
|
switch (sizeVar) {
|
|
1053
1053
|
case "XS":
|
|
1054
|
-
return react.css`
|
|
1054
|
+
return react$1.css`
|
|
1055
1055
|
padding: 4px 8px;
|
|
1056
1056
|
`;
|
|
1057
1057
|
case "S":
|
|
1058
|
-
return react.css`
|
|
1058
|
+
return react$1.css`
|
|
1059
1059
|
padding: 7px 12px;
|
|
1060
1060
|
`;
|
|
1061
1061
|
default:
|
|
1062
|
-
return react.css`
|
|
1062
|
+
return react$1.css`
|
|
1063
1063
|
padding: 7px 12px;
|
|
1064
1064
|
`;
|
|
1065
1065
|
}
|
|
@@ -1123,7 +1123,7 @@ exports.ChipButton = ChipButton;
|
|
|
1123
1123
|
var getStyleByStyleVar = (styleVar, color, disabled) => {
|
|
1124
1124
|
switch (styleVar) {
|
|
1125
1125
|
case "PRIMARY":
|
|
1126
|
-
return react.css`
|
|
1126
|
+
return react$1.css`
|
|
1127
1127
|
border: 1px solid ${exports.colorTokens.primary400};
|
|
1128
1128
|
background-color: ${exports.colorTokens.primary300};
|
|
1129
1129
|
:hover {
|
|
@@ -1131,7 +1131,7 @@ var getStyleByStyleVar = (styleVar, color, disabled) => {
|
|
|
1131
1131
|
}
|
|
1132
1132
|
`;
|
|
1133
1133
|
case "SECONDARY":
|
|
1134
|
-
return react.css`
|
|
1134
|
+
return react$1.css`
|
|
1135
1135
|
border: 1px solid ${exports.colorTokens.neutral350};
|
|
1136
1136
|
background-color: ${exports.colorTokens.neutral0};
|
|
1137
1137
|
:hover {
|
|
@@ -1142,7 +1142,7 @@ var getStyleByStyleVar = (styleVar, color, disabled) => {
|
|
|
1142
1142
|
if (!color) {
|
|
1143
1143
|
throw new Error("Button\uC758 SOLID \uC18D\uC131\uC740 color\uB97C \uD544\uC218\uB85C \uBC1B\uC2B5\uB2C8\uB2E4.");
|
|
1144
1144
|
}
|
|
1145
|
-
return react.css`
|
|
1145
|
+
return react$1.css`
|
|
1146
1146
|
border: 1px solid ${exports.colorTokens[getNextColor(color)]};
|
|
1147
1147
|
background-color: ${exports.colorTokens[color]};
|
|
1148
1148
|
:hover {
|
|
@@ -1150,7 +1150,7 @@ var getStyleByStyleVar = (styleVar, color, disabled) => {
|
|
|
1150
1150
|
}
|
|
1151
1151
|
`;
|
|
1152
1152
|
case "GHOST":
|
|
1153
|
-
return react.css`
|
|
1153
|
+
return react$1.css`
|
|
1154
1154
|
border: 1px solid transparent;
|
|
1155
1155
|
background-color: transparent;
|
|
1156
1156
|
:hover {
|
|
@@ -1158,7 +1158,7 @@ var getStyleByStyleVar = (styleVar, color, disabled) => {
|
|
|
1158
1158
|
}
|
|
1159
1159
|
`;
|
|
1160
1160
|
default:
|
|
1161
|
-
return react.css`
|
|
1161
|
+
return react$1.css`
|
|
1162
1162
|
border: 1px solid ${exports.colorTokens.primary400};
|
|
1163
1163
|
background-color: ${exports.colorTokens.primary300};
|
|
1164
1164
|
`;
|
|
@@ -1167,17 +1167,17 @@ var getStyleByStyleVar = (styleVar, color, disabled) => {
|
|
|
1167
1167
|
var getStyleBySizeVar2 = (sizeVar) => {
|
|
1168
1168
|
switch (sizeVar) {
|
|
1169
1169
|
case "M":
|
|
1170
|
-
return react.css`
|
|
1170
|
+
return react$1.css`
|
|
1171
1171
|
min-width: 72px;
|
|
1172
1172
|
min-height: 40px;
|
|
1173
1173
|
`;
|
|
1174
1174
|
case "S":
|
|
1175
|
-
return react.css`
|
|
1175
|
+
return react$1.css`
|
|
1176
1176
|
min-width: 54px;
|
|
1177
1177
|
min-height: 32px;
|
|
1178
1178
|
`;
|
|
1179
1179
|
default:
|
|
1180
|
-
return react.css`
|
|
1180
|
+
return react$1.css`
|
|
1181
1181
|
min-width: 72px;
|
|
1182
1182
|
min-height: 40px;
|
|
1183
1183
|
`;
|
|
@@ -1264,21 +1264,21 @@ exports.buttonStyleVar = {
|
|
|
1264
1264
|
var getWidthAndHeightFromSizeVar = (sizeVar) => {
|
|
1265
1265
|
switch (sizeVar) {
|
|
1266
1266
|
case "M":
|
|
1267
|
-
return react.css`
|
|
1267
|
+
return react$1.css`
|
|
1268
1268
|
width: 40px;
|
|
1269
1269
|
min-width: 40px;
|
|
1270
1270
|
height: 40px;
|
|
1271
1271
|
min-height: 40px;
|
|
1272
1272
|
`;
|
|
1273
1273
|
case "S":
|
|
1274
|
-
return react.css`
|
|
1274
|
+
return react$1.css`
|
|
1275
1275
|
width: 32px;
|
|
1276
1276
|
min-width: 32px;
|
|
1277
1277
|
height: 32px;
|
|
1278
1278
|
min-height: 32px;
|
|
1279
1279
|
`;
|
|
1280
1280
|
default:
|
|
1281
|
-
return react.css`
|
|
1281
|
+
return react$1.css`
|
|
1282
1282
|
width: 40px;
|
|
1283
1283
|
min-width: 40px;
|
|
1284
1284
|
height: 40px;
|
|
@@ -1289,7 +1289,7 @@ var getWidthAndHeightFromSizeVar = (sizeVar) => {
|
|
|
1289
1289
|
var getStyleByStyleVar2 = (styleVar, color) => {
|
|
1290
1290
|
switch (styleVar) {
|
|
1291
1291
|
case "PRIMARY":
|
|
1292
|
-
return react.css`
|
|
1292
|
+
return react$1.css`
|
|
1293
1293
|
background: ${exports.colorTokens.primary300};
|
|
1294
1294
|
border: 1px solid ${exports.colorTokens.primary400};
|
|
1295
1295
|
&:hover {
|
|
@@ -1297,7 +1297,7 @@ var getStyleByStyleVar2 = (styleVar, color) => {
|
|
|
1297
1297
|
}
|
|
1298
1298
|
`;
|
|
1299
1299
|
case "SECONDARY":
|
|
1300
|
-
return react.css`
|
|
1300
|
+
return react$1.css`
|
|
1301
1301
|
background: ${exports.colorTokens.neutral0};
|
|
1302
1302
|
border: 1px solid ${exports.colorTokens.neutral350};
|
|
1303
1303
|
&:hover {
|
|
@@ -1308,7 +1308,7 @@ var getStyleByStyleVar2 = (styleVar, color) => {
|
|
|
1308
1308
|
if (!color) {
|
|
1309
1309
|
throw new Error("IconButton\uC758 SOLID \uC18D\uC131\uC740 color\uB97C \uD544\uC218\uB85C \uBC1B\uC2B5\uB2C8\uB2E4.");
|
|
1310
1310
|
}
|
|
1311
|
-
return react.css`
|
|
1311
|
+
return react$1.css`
|
|
1312
1312
|
border: 1px solid ${exports.colorTokens[getNextColor(color)]};
|
|
1313
1313
|
background: ${exports.colorTokens[color]};
|
|
1314
1314
|
&:hover {
|
|
@@ -1316,14 +1316,14 @@ var getStyleByStyleVar2 = (styleVar, color) => {
|
|
|
1316
1316
|
}
|
|
1317
1317
|
`;
|
|
1318
1318
|
case "GHOST":
|
|
1319
|
-
return react.css`
|
|
1319
|
+
return react$1.css`
|
|
1320
1320
|
border: 1px solid transparent;
|
|
1321
1321
|
&:hover {
|
|
1322
1322
|
background: ${exports.colorTokens.neutral400_5};
|
|
1323
1323
|
}
|
|
1324
1324
|
`;
|
|
1325
1325
|
default:
|
|
1326
|
-
return react.css`
|
|
1326
|
+
return react$1.css`
|
|
1327
1327
|
border: 1px solid ${exports.colorTokens.neutral200};
|
|
1328
1328
|
&:hover {
|
|
1329
1329
|
background: ${exports.colorTokens.neutral100};
|
|
@@ -1378,7 +1378,7 @@ exports.iconButtonStyleVar = {
|
|
|
1378
1378
|
SOLID: "SOLID",
|
|
1379
1379
|
GHOST: "GHOST"
|
|
1380
1380
|
};
|
|
1381
|
-
var informationStyle = react.css`
|
|
1381
|
+
var informationStyle = react$1.css`
|
|
1382
1382
|
background: ${exports.colorTokens.neutral100};
|
|
1383
1383
|
& > span {
|
|
1384
1384
|
color: ${exports.colorTokens.neutral600};
|
|
@@ -1387,7 +1387,7 @@ var informationStyle = react.css`
|
|
|
1387
1387
|
fill: ${exports.colorTokens.neutral600};
|
|
1388
1388
|
}
|
|
1389
1389
|
`;
|
|
1390
|
-
var alertStyle = react.css`
|
|
1390
|
+
var alertStyle = react$1.css`
|
|
1391
1391
|
background: ${exports.colorTokens.red100};
|
|
1392
1392
|
& > span {
|
|
1393
1393
|
align-self: center;
|
|
@@ -1436,10 +1436,8 @@ exports.CalloutTypes = {
|
|
|
1436
1436
|
ALERT: "ALERT"
|
|
1437
1437
|
};
|
|
1438
1438
|
exports.StyledPopper = styled5__default.default.div`
|
|
1439
|
-
display: flex;
|
|
1440
|
-
flex-direction: row;
|
|
1441
1439
|
width: ${({ width }) => width != null ? width : "fit-content"};
|
|
1442
|
-
height: ${({ height }) => height
|
|
1440
|
+
height: ${({ height }) => height && height};
|
|
1443
1441
|
`;
|
|
1444
1442
|
var PopperContext = React3.createContext(null);
|
|
1445
1443
|
var usePopper = () => {
|
|
@@ -1485,10 +1483,10 @@ var Popper = ({
|
|
|
1485
1483
|
const { refs, floatingStyles } = reactDom.useFloating({
|
|
1486
1484
|
strategy,
|
|
1487
1485
|
placement,
|
|
1488
|
-
whileElementsMounted: react
|
|
1486
|
+
whileElementsMounted: react.autoUpdate,
|
|
1489
1487
|
middleware: [
|
|
1490
|
-
react
|
|
1491
|
-
initialAutoPlacement && react
|
|
1488
|
+
react.offset(initialOffset),
|
|
1489
|
+
initialAutoPlacement && react.autoPlacement(__spreadValues({
|
|
1492
1490
|
crossAxis: false
|
|
1493
1491
|
}, initialAutoPlacement)),
|
|
1494
1492
|
...middlewares != null ? middlewares : []
|
|
@@ -1512,7 +1510,7 @@ exports.PopperPortal = React3.forwardRef(
|
|
|
1512
1510
|
const { floatingStyles, setFloating, isOpen } = usePopper();
|
|
1513
1511
|
const animation = initialAnimation != null ? initialAnimation : fadeInOut;
|
|
1514
1512
|
const refs = useMergeRefs(ref, setFloating);
|
|
1515
|
-
return /* @__PURE__ */ jsxRuntime.jsx(react
|
|
1513
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.FloatingPortal, { id: "popper-portal-key", children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { children: isOpen && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1516
1514
|
framerMotion.motion.div,
|
|
1517
1515
|
{
|
|
1518
1516
|
initial: animation.initial,
|
|
@@ -1528,8 +1526,8 @@ exports.PopperPortal = React3.forwardRef(
|
|
|
1528
1526
|
Popper.Trigger = exports.PopperTrigger;
|
|
1529
1527
|
Popper.Portal = exports.PopperPortal;
|
|
1530
1528
|
exports.Popper = Popper;
|
|
1531
|
-
exports.getDropdownHeightBySizeVar = (
|
|
1532
|
-
switch (
|
|
1529
|
+
exports.getDropdownHeightBySizeVar = (size2) => {
|
|
1530
|
+
switch (size2) {
|
|
1533
1531
|
case "M":
|
|
1534
1532
|
return "40px";
|
|
1535
1533
|
case "S":
|
|
@@ -1538,8 +1536,8 @@ exports.getDropdownHeightBySizeVar = (size) => {
|
|
|
1538
1536
|
return "40px";
|
|
1539
1537
|
}
|
|
1540
1538
|
};
|
|
1541
|
-
exports.getDropdownFontSizeBySizeVar = (
|
|
1542
|
-
switch (
|
|
1539
|
+
exports.getDropdownFontSizeBySizeVar = (size2) => {
|
|
1540
|
+
switch (size2) {
|
|
1543
1541
|
case "M":
|
|
1544
1542
|
return "body1_400";
|
|
1545
1543
|
case "S":
|
|
@@ -1548,40 +1546,40 @@ exports.getDropdownFontSizeBySizeVar = (size) => {
|
|
|
1548
1546
|
return "body1_400";
|
|
1549
1547
|
}
|
|
1550
1548
|
};
|
|
1551
|
-
exports.getDropdownStyleBySizeVar = (
|
|
1552
|
-
switch (
|
|
1549
|
+
exports.getDropdownStyleBySizeVar = (size2) => {
|
|
1550
|
+
switch (size2) {
|
|
1553
1551
|
case "M":
|
|
1554
|
-
return react.css`
|
|
1552
|
+
return react$1.css`
|
|
1555
1553
|
padding: 4px 4px 4px 12px;
|
|
1556
1554
|
`;
|
|
1557
1555
|
case "S":
|
|
1558
|
-
return react.css`
|
|
1556
|
+
return react$1.css`
|
|
1559
1557
|
padding: 4px 4px 4px 8px;
|
|
1560
1558
|
`;
|
|
1561
1559
|
default:
|
|
1562
|
-
return react.css`
|
|
1560
|
+
return react$1.css`
|
|
1563
1561
|
padding: 4px 4px 4px 12px;
|
|
1564
1562
|
`;
|
|
1565
1563
|
}
|
|
1566
1564
|
};
|
|
1567
|
-
exports.getDropdownIconSizeBySizeVar = (
|
|
1568
|
-
switch (
|
|
1565
|
+
exports.getDropdownIconSizeBySizeVar = (size2) => {
|
|
1566
|
+
switch (size2) {
|
|
1569
1567
|
case "S":
|
|
1570
|
-
return react.css`
|
|
1568
|
+
return react$1.css`
|
|
1571
1569
|
height: 24px;
|
|
1572
1570
|
width: 24px;
|
|
1573
1571
|
min-width: 24px;
|
|
1574
1572
|
min-height: 24px;
|
|
1575
1573
|
`;
|
|
1576
1574
|
case "M":
|
|
1577
|
-
return react.css`
|
|
1575
|
+
return react$1.css`
|
|
1578
1576
|
height: 32px;
|
|
1579
1577
|
width: 32px;
|
|
1580
1578
|
min-width: 32px;
|
|
1581
1579
|
min-height: 32px;
|
|
1582
1580
|
`;
|
|
1583
1581
|
default:
|
|
1584
|
-
return react.css`
|
|
1582
|
+
return react$1.css`
|
|
1585
1583
|
height: 32px;
|
|
1586
1584
|
width: 32px;
|
|
1587
1585
|
min-width: 32px;
|
|
@@ -1590,10 +1588,7 @@ exports.getDropdownIconSizeBySizeVar = (size) => {
|
|
|
1590
1588
|
}
|
|
1591
1589
|
};
|
|
1592
1590
|
exports.StyledDropdown = styled5__default.default.div`
|
|
1593
|
-
|
|
1594
|
-
width: fit-content;
|
|
1595
|
-
height: fit-content;
|
|
1596
|
-
flex-direction: row;
|
|
1591
|
+
width: ${({ width }) => width};
|
|
1597
1592
|
`;
|
|
1598
1593
|
exports.StyledDropdownContent = styled5__default.default.div`
|
|
1599
1594
|
display: flex;
|
|
@@ -1614,7 +1609,7 @@ exports.StyledDropdownButton = styled5__default.default.button`
|
|
|
1614
1609
|
gap: 8px;
|
|
1615
1610
|
cursor: pointer;
|
|
1616
1611
|
${({ sizeVar }) => sizeVar && exports.getDropdownStyleBySizeVar(sizeVar)};
|
|
1617
|
-
${({ disabled }) => disabled && react.css`
|
|
1612
|
+
${({ disabled }) => disabled && react$1.css`
|
|
1618
1613
|
cursor: not-allowed;
|
|
1619
1614
|
`}
|
|
1620
1615
|
`;
|
|
@@ -1674,8 +1669,8 @@ exports.IconSizeVariants = {
|
|
|
1674
1669
|
};
|
|
1675
1670
|
|
|
1676
1671
|
// src/components/Icon/Icon.styled.ts
|
|
1677
|
-
var getIconSize = (
|
|
1678
|
-
switch (
|
|
1672
|
+
var getIconSize = (size2) => {
|
|
1673
|
+
switch (size2) {
|
|
1679
1674
|
case exports.IconSizeVariants.XS:
|
|
1680
1675
|
return "12px";
|
|
1681
1676
|
case exports.IconSizeVariants.S:
|
|
@@ -1771,32 +1766,37 @@ var DropdownButton = React3.forwardRef(
|
|
|
1771
1766
|
);
|
|
1772
1767
|
}
|
|
1773
1768
|
);
|
|
1774
|
-
var DropdownContent =
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1769
|
+
var DropdownContent = (_a) => {
|
|
1770
|
+
var _b = _a, { children, width: initialWidth, type, onClick } = _b, rest = __objRest(_b, ["children", "width", "type", "onClick"]);
|
|
1771
|
+
const { width, setIsOpen, option } = useDropdown();
|
|
1772
|
+
const isFillType = type === "FILL";
|
|
1773
|
+
const contentWidth = isFillType ? `${width}px` : initialWidth;
|
|
1774
|
+
const returnCallbackByOption = () => {
|
|
1775
|
+
if (option === "OUTSIDE_CLICK") {
|
|
1776
|
+
return () => setIsOpen(false);
|
|
1777
|
+
}
|
|
1778
|
+
if (option === "CLICK") {
|
|
1779
|
+
return () => setIsOpen(false);
|
|
1780
|
+
}
|
|
1781
|
+
return utils.noop;
|
|
1782
|
+
};
|
|
1783
|
+
const handleClick = (e) => {
|
|
1784
|
+
onClick && onClick(e);
|
|
1785
|
+
if (option === "CLICK") {
|
|
1786
|
+
setIsOpen(false);
|
|
1787
|
+
}
|
|
1788
|
+
};
|
|
1789
|
+
return /* @__PURE__ */ jsxRuntime.jsx(utils.OutSideClick, { outsideClick: returnCallbackByOption(), children: /* @__PURE__ */ jsxRuntime.jsx(exports.StyledDropdownContent, __spreadProps(__spreadValues({ width: contentWidth, onClick: handleClick }, rest), { children })) });
|
|
1790
|
+
};
|
|
1791
|
+
var Dropdown = ({
|
|
1792
|
+
isOpen: initialIsOpen = false,
|
|
1793
|
+
trigger,
|
|
1794
|
+
popper,
|
|
1795
|
+
option = "CLICK",
|
|
1796
|
+
width = "100%"
|
|
1797
|
+
}) => {
|
|
1798
1798
|
const [triggerRef, setTriggerRef] = React3.useState(null);
|
|
1799
|
-
const [
|
|
1799
|
+
const [size2, setSize] = React3.useState({ width: 0, height: 0 });
|
|
1800
1800
|
const [isOpen, setIsOpen] = React3.useState(false);
|
|
1801
1801
|
React3.useEffect(() => {
|
|
1802
1802
|
if (triggerRef) {
|
|
@@ -1812,15 +1812,16 @@ var Dropdown = ({ isOpen: initialIsOpen, trigger, content, option = "OUTSIDE_CLI
|
|
|
1812
1812
|
}
|
|
1813
1813
|
setIsOpen(initialIsOpen);
|
|
1814
1814
|
}, [initialIsOpen]);
|
|
1815
|
-
return /* @__PURE__ */ jsxRuntime.jsx(exports.StyledDropdown, { "data-shoplflow": "Dropdown", children: /* @__PURE__ */ jsxRuntime.jsx(DropdownContext.Provider, { value: __spreadProps(__spreadValues({},
|
|
1815
|
+
return /* @__PURE__ */ jsxRuntime.jsx(exports.StyledDropdown, { "data-shoplflow": "Dropdown", width, children: /* @__PURE__ */ jsxRuntime.jsx(DropdownContext.Provider, { value: __spreadProps(__spreadValues({}, size2), { isOpen, setIsOpen, option }), children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1816
1816
|
exports.Popper,
|
|
1817
1817
|
{
|
|
1818
|
+
offset: 4,
|
|
1818
1819
|
autoPlacement: {
|
|
1819
1820
|
allowedPlacements: ["bottom-start", "top-start"]
|
|
1820
1821
|
},
|
|
1821
1822
|
children: [
|
|
1822
|
-
/* @__PURE__ */ jsxRuntime.jsx(exports.Popper.Trigger, { ref: setTriggerRef, isOpen, children: trigger }),
|
|
1823
|
-
/* @__PURE__ */ jsxRuntime.jsx(exports.Popper.Portal, { children:
|
|
1823
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.Popper.Trigger, { ref: setTriggerRef, isOpen, width, children: trigger }),
|
|
1824
|
+
/* @__PURE__ */ jsxRuntime.jsx(exports.Popper.Portal, { children: popper })
|
|
1824
1825
|
]
|
|
1825
1826
|
}
|
|
1826
1827
|
) }) });
|
|
@@ -2028,7 +2029,7 @@ exports.StyledInputButton = styled5__default.default.button`
|
|
|
2028
2029
|
gap: 4px;
|
|
2029
2030
|
padding: 4px 4px 4px 12px;
|
|
2030
2031
|
cursor: pointer;
|
|
2031
|
-
${({ disabled }) => disabled && react.css`
|
|
2032
|
+
${({ disabled }) => disabled && react$1.css`
|
|
2032
2033
|
cursor: not-allowed;
|
|
2033
2034
|
`}
|
|
2034
2035
|
`;
|
|
@@ -2301,5 +2302,34 @@ var MinusButton = React3.forwardRef((_a, ref) => {
|
|
|
2301
2302
|
] }) })) });
|
|
2302
2303
|
});
|
|
2303
2304
|
exports.MinusButton = MinusButton;
|
|
2305
|
+
|
|
2306
|
+
Object.defineProperty(exports, 'arrow', {
|
|
2307
|
+
enumerable: true,
|
|
2308
|
+
get: function () { return react.arrow; }
|
|
2309
|
+
});
|
|
2310
|
+
Object.defineProperty(exports, 'flip', {
|
|
2311
|
+
enumerable: true,
|
|
2312
|
+
get: function () { return react.flip; }
|
|
2313
|
+
});
|
|
2314
|
+
Object.defineProperty(exports, 'hide', {
|
|
2315
|
+
enumerable: true,
|
|
2316
|
+
get: function () { return react.hide; }
|
|
2317
|
+
});
|
|
2318
|
+
Object.defineProperty(exports, 'inline', {
|
|
2319
|
+
enumerable: true,
|
|
2320
|
+
get: function () { return react.inline; }
|
|
2321
|
+
});
|
|
2322
|
+
Object.defineProperty(exports, 'offset', {
|
|
2323
|
+
enumerable: true,
|
|
2324
|
+
get: function () { return react.offset; }
|
|
2325
|
+
});
|
|
2326
|
+
Object.defineProperty(exports, 'shift', {
|
|
2327
|
+
enumerable: true,
|
|
2328
|
+
get: function () { return react.shift; }
|
|
2329
|
+
});
|
|
2330
|
+
Object.defineProperty(exports, 'size', {
|
|
2331
|
+
enumerable: true,
|
|
2332
|
+
get: function () { return react.size; }
|
|
2333
|
+
});
|
|
2304
2334
|
//# sourceMappingURL=out.js.map
|
|
2305
2335
|
//# sourceMappingURL=index.cjs.map
|