@shoplflow/base 0.46.9 → 0.46.10
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 +100 -58
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +101 -59
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3158,33 +3158,31 @@ var getDropdownFontSizeBySizeVar = (size2) => {
|
|
|
3158
3158
|
case "M":
|
|
3159
3159
|
return "body1_400";
|
|
3160
3160
|
case "S":
|
|
3161
|
-
return "
|
|
3161
|
+
return "body1_400";
|
|
3162
3162
|
default:
|
|
3163
3163
|
return "body1_400";
|
|
3164
3164
|
}
|
|
3165
3165
|
};
|
|
3166
3166
|
var getDropdownStyleBySizeVar = (size2) => {
|
|
3167
3167
|
switch (size2) {
|
|
3168
|
-
case "
|
|
3168
|
+
case "S":
|
|
3169
3169
|
return react$1.css`
|
|
3170
|
-
|
|
3171
|
-
padding: 8px 4px 8px 12px;
|
|
3170
|
+
padding: 0 8px;
|
|
3172
3171
|
`;
|
|
3173
3172
|
case "M":
|
|
3174
3173
|
return react$1.css`
|
|
3175
|
-
|
|
3176
|
-
gap: 4px;
|
|
3177
|
-
padding: 4px 4px 4px 12px;
|
|
3174
|
+
padding: 0 12px;
|
|
3178
3175
|
`;
|
|
3179
|
-
case "
|
|
3176
|
+
case "L":
|
|
3180
3177
|
return react$1.css`
|
|
3181
|
-
background-color:
|
|
3182
|
-
padding:
|
|
3183
|
-
|
|
3178
|
+
background-color: transparent;
|
|
3179
|
+
padding-left: 12px;
|
|
3180
|
+
padding-right: 6px;
|
|
3184
3181
|
`;
|
|
3185
3182
|
default:
|
|
3186
3183
|
return react$1.css`
|
|
3187
|
-
|
|
3184
|
+
background-color: ${exports.colorTokens.neutral0};
|
|
3185
|
+
padding: 0 8px;
|
|
3188
3186
|
`;
|
|
3189
3187
|
}
|
|
3190
3188
|
};
|
|
@@ -3193,28 +3191,12 @@ var getDisabledStyle2 = (disabled) => {
|
|
|
3193
3191
|
return react$1.css`
|
|
3194
3192
|
cursor: not-allowed;
|
|
3195
3193
|
background: ${exports.colorTokens.neutral100};
|
|
3194
|
+
svg > path {
|
|
3195
|
+
fill: ${exports.colorTokens.neutral400} !important;
|
|
3196
|
+
}
|
|
3196
3197
|
`;
|
|
3197
3198
|
}
|
|
3198
3199
|
};
|
|
3199
|
-
var getDropdownIconSizeBySizeVar = (size2) => {
|
|
3200
|
-
switch (size2) {
|
|
3201
|
-
case "S":
|
|
3202
|
-
case "L":
|
|
3203
|
-
return react$1.css`
|
|
3204
|
-
height: 24px;
|
|
3205
|
-
width: 24px;
|
|
3206
|
-
min-width: 24px;
|
|
3207
|
-
min-height: 24px;
|
|
3208
|
-
`;
|
|
3209
|
-
default:
|
|
3210
|
-
return react$1.css`
|
|
3211
|
-
height: 32px;
|
|
3212
|
-
width: 32px;
|
|
3213
|
-
min-width: 32px;
|
|
3214
|
-
min-height: 32px;
|
|
3215
|
-
`;
|
|
3216
|
-
}
|
|
3217
|
-
};
|
|
3218
3200
|
var getBorderColorByStatus = ({ isFocused, isError, isHovered, disabled, sizeVar }) => {
|
|
3219
3201
|
if (!disabled) {
|
|
3220
3202
|
if (isError) {
|
|
@@ -3259,7 +3241,17 @@ var getStyleByType = ({
|
|
|
3259
3241
|
height: ${height || "initial"};
|
|
3260
3242
|
`;
|
|
3261
3243
|
};
|
|
3262
|
-
var
|
|
3244
|
+
var getClearIconHoverStyle = (hasValue) => {
|
|
3245
|
+
if (!hasValue) {
|
|
3246
|
+
return;
|
|
3247
|
+
}
|
|
3248
|
+
return react$1.css`
|
|
3249
|
+
&:hover .dropdown-clear-icon {
|
|
3250
|
+
display: flex;
|
|
3251
|
+
}
|
|
3252
|
+
`;
|
|
3253
|
+
};
|
|
3254
|
+
var StyledDropdownButtonWrapper = styled6__default.default.div`
|
|
3263
3255
|
position: relative;
|
|
3264
3256
|
display: flex;
|
|
3265
3257
|
align-items: center;
|
|
@@ -3277,33 +3269,63 @@ var StyledDropdownButtonWrapper = styled6__default.default.label`
|
|
|
3277
3269
|
width
|
|
3278
3270
|
})};
|
|
3279
3271
|
${(props) => getButtonWrapperStyleBySizeVar(props)};
|
|
3280
|
-
|
|
3281
3272
|
${({ disabled }) => getDisabledStyle2(disabled)};
|
|
3273
|
+
|
|
3274
|
+
${({ hasValue }) => getClearIconHoverStyle(hasValue)}
|
|
3282
3275
|
`;
|
|
3283
3276
|
var StyledDropdownButton = styled6__default.default.button`
|
|
3277
|
+
position: relative;
|
|
3284
3278
|
display: flex;
|
|
3285
3279
|
flex-direction: row;
|
|
3286
3280
|
align-items: center;
|
|
3287
3281
|
justify-content: space-between;
|
|
3288
3282
|
width: 100%;
|
|
3289
3283
|
height: 100%;
|
|
3290
|
-
|
|
3291
3284
|
cursor: pointer;
|
|
3285
|
+
|
|
3292
3286
|
${({ sizeVar }) => sizeVar && getDropdownStyleBySizeVar(sizeVar)};
|
|
3293
3287
|
${({ disabled }) => getDisabledStyle2(disabled)};
|
|
3288
|
+
|
|
3289
|
+
.dropdown-clear-icon {
|
|
3290
|
+
display: none;
|
|
3291
|
+
position: absolute;
|
|
3292
|
+
right: 0;
|
|
3293
|
+
}
|
|
3294
3294
|
`;
|
|
3295
|
-
var DropdownButtonIcon = styled6__default.default
|
|
3295
|
+
var DropdownButtonIcon = styled6__default.default.div`
|
|
3296
3296
|
display: flex;
|
|
3297
3297
|
align-items: center;
|
|
3298
|
-
justify-content: center;
|
|
3299
3298
|
flex-shrink: 0;
|
|
3299
|
+
min-width: 22px;
|
|
3300
|
+
height: 100%;
|
|
3300
3301
|
|
|
3301
|
-
${({ sizeVar }) => sizeVar && getDropdownIconSizeBySizeVar(sizeVar)};
|
|
3302
3302
|
${({ disabled }) => getDisabledStyle2(disabled)};
|
|
3303
3303
|
`;
|
|
3304
3304
|
var DropdownTriggerButton = React3.forwardRef(
|
|
3305
3305
|
(_a, ref) => {
|
|
3306
|
-
var _b = _a, {
|
|
3306
|
+
var _b = _a, {
|
|
3307
|
+
width = "100%",
|
|
3308
|
+
onClick,
|
|
3309
|
+
sizeVar = "M",
|
|
3310
|
+
isError,
|
|
3311
|
+
placeholder,
|
|
3312
|
+
value,
|
|
3313
|
+
disabled,
|
|
3314
|
+
leftSource,
|
|
3315
|
+
rightSource,
|
|
3316
|
+
onClear
|
|
3317
|
+
} = _b, rest = __objRest(_b, [
|
|
3318
|
+
"width",
|
|
3319
|
+
"onClick",
|
|
3320
|
+
"sizeVar",
|
|
3321
|
+
"isError",
|
|
3322
|
+
"placeholder",
|
|
3323
|
+
"value",
|
|
3324
|
+
"disabled",
|
|
3325
|
+
"leftSource",
|
|
3326
|
+
"rightSource",
|
|
3327
|
+
"onClear"
|
|
3328
|
+
]);
|
|
3307
3329
|
const { isOpen, setIsOpen } = useDropdown();
|
|
3308
3330
|
const [isHovered, setIsHovered] = React3.useState(false);
|
|
3309
3331
|
const handleOnClick = (e) => {
|
|
@@ -3318,6 +3340,10 @@ var DropdownTriggerButton = React3.forwardRef(
|
|
|
3318
3340
|
const handleOnMouseLeave = () => {
|
|
3319
3341
|
setIsHovered(false);
|
|
3320
3342
|
};
|
|
3343
|
+
const handleOnClear = (e) => {
|
|
3344
|
+
e.stopPropagation();
|
|
3345
|
+
onClear && onClear();
|
|
3346
|
+
};
|
|
3321
3347
|
const getTextColor = ({ value: value2, disabled: disabled2 }) => {
|
|
3322
3348
|
if (disabled2) {
|
|
3323
3349
|
return "neutral350";
|
|
@@ -3328,7 +3354,8 @@ var DropdownTriggerButton = React3.forwardRef(
|
|
|
3328
3354
|
return "neutral700";
|
|
3329
3355
|
};
|
|
3330
3356
|
const LeftSourceClone = leftSource ? React3.cloneElement(leftSource, __spreadProps(__spreadValues({}, leftSource.props), { disabled })) : leftSource;
|
|
3331
|
-
|
|
3357
|
+
const RightSourceClone = rightSource ? React3.cloneElement(rightSource, __spreadProps(__spreadValues({}, rightSource.props), { disabled })) : rightSource;
|
|
3358
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3332
3359
|
StyledDropdownButtonWrapper,
|
|
3333
3360
|
{
|
|
3334
3361
|
onMouseEnter: handleOnMouseEnter,
|
|
@@ -3340,24 +3367,39 @@ var DropdownTriggerButton = React3.forwardRef(
|
|
|
3340
3367
|
isError,
|
|
3341
3368
|
sizeVar,
|
|
3342
3369
|
height: getDropdownHeightBySizeVar(sizeVar),
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
lineClamp: 1,
|
|
3353
|
-
children: placeholder
|
|
3354
|
-
}
|
|
3355
|
-
)
|
|
3356
|
-
] }),
|
|
3357
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3358
|
-
DropdownButtonIcon,
|
|
3359
|
-
{
|
|
3370
|
+
hasValue: Boolean(value),
|
|
3371
|
+
children: [
|
|
3372
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3373
|
+
StyledDropdownButton,
|
|
3374
|
+
__spreadProps(__spreadValues({
|
|
3375
|
+
ref,
|
|
3376
|
+
onClick: handleOnClick,
|
|
3377
|
+
disabled
|
|
3378
|
+
}, rest), {
|
|
3360
3379
|
sizeVar,
|
|
3380
|
+
"data-shoplflow": "Dropdown-Content-Area",
|
|
3381
|
+
children: [
|
|
3382
|
+
/* @__PURE__ */ jsxRuntime.jsxs(exports.Stack.Horizontal, { width: "100%", spacing: "spacing04", align: "center", children: [
|
|
3383
|
+
LeftSourceClone && LeftSourceClone,
|
|
3384
|
+
value || /* @__PURE__ */ jsxRuntime.jsx(
|
|
3385
|
+
exports.Text,
|
|
3386
|
+
{
|
|
3387
|
+
typography: getDropdownFontSizeBySizeVar(sizeVar),
|
|
3388
|
+
color: getTextColor({ value, disabled }),
|
|
3389
|
+
textOverflow: "ellipsis",
|
|
3390
|
+
lineClamp: 1,
|
|
3391
|
+
children: placeholder
|
|
3392
|
+
}
|
|
3393
|
+
)
|
|
3394
|
+
] }),
|
|
3395
|
+
onClear && sizeVar !== "L" && /* @__PURE__ */ jsxRuntime.jsx(exports.IconButton, { sizeVar, styleVar: "GHOST", onClick: handleOnClear, className: "dropdown-clear-icon", children: /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { iconSource: ShoplAssets.DeleteIcon, color: "neutral350", sizeVar: "S" }) })
|
|
3396
|
+
]
|
|
3397
|
+
})
|
|
3398
|
+
),
|
|
3399
|
+
RightSourceClone && /* @__PURE__ */ jsxRuntime.jsx(exports.StackContainer, { padding: "0 6px 0 0", children: RightSourceClone }),
|
|
3400
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownButtonIcon, { sizeVar, "data-shoplflow": "Dropdown-Button-Icon-Area", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3401
|
+
framerMotion.motion.div,
|
|
3402
|
+
{
|
|
3361
3403
|
animate: {
|
|
3362
3404
|
rotate: isOpen ? 180 : 0
|
|
3363
3405
|
},
|
|
@@ -3373,8 +3415,8 @@ var DropdownTriggerButton = React3.forwardRef(
|
|
|
3373
3415
|
}
|
|
3374
3416
|
)
|
|
3375
3417
|
}
|
|
3376
|
-
)
|
|
3377
|
-
]
|
|
3418
|
+
) })
|
|
3419
|
+
]
|
|
3378
3420
|
}
|
|
3379
3421
|
);
|
|
3380
3422
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -1022,7 +1022,7 @@ declare const dropdownSizeVariants: {
|
|
|
1022
1022
|
readonly L: "L";
|
|
1023
1023
|
};
|
|
1024
1024
|
type DropdownSizeVariantType = $Values<typeof dropdownSizeVariants>;
|
|
1025
|
-
interface DropdownTriggerButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value'>, DisableProps,
|
|
1025
|
+
interface DropdownTriggerButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value'>, DisableProps, LeftAndRightElementProps, SizeVariantProps<DropdownSizeVariantType> {
|
|
1026
1026
|
/**
|
|
1027
1027
|
* placeholder를 설정합니다.
|
|
1028
1028
|
*/
|
|
@@ -1033,6 +1033,7 @@ interface DropdownTriggerButtonProps extends Omit<ButtonHTMLAttributes<HTMLButto
|
|
|
1033
1033
|
* width를 설정합니다.
|
|
1034
1034
|
*/
|
|
1035
1035
|
width?: string;
|
|
1036
|
+
onClear?: () => void;
|
|
1036
1037
|
}
|
|
1037
1038
|
|
|
1038
1039
|
declare const Dropdown: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1022,7 +1022,7 @@ declare const dropdownSizeVariants: {
|
|
|
1022
1022
|
readonly L: "L";
|
|
1023
1023
|
};
|
|
1024
1024
|
type DropdownSizeVariantType = $Values<typeof dropdownSizeVariants>;
|
|
1025
|
-
interface DropdownTriggerButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value'>, DisableProps,
|
|
1025
|
+
interface DropdownTriggerButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'value'>, DisableProps, LeftAndRightElementProps, SizeVariantProps<DropdownSizeVariantType> {
|
|
1026
1026
|
/**
|
|
1027
1027
|
* placeholder를 설정합니다.
|
|
1028
1028
|
*/
|
|
@@ -1033,6 +1033,7 @@ interface DropdownTriggerButtonProps extends Omit<ButtonHTMLAttributes<HTMLButto
|
|
|
1033
1033
|
* width를 설정합니다.
|
|
1034
1034
|
*/
|
|
1035
1035
|
width?: string;
|
|
1036
|
+
onClear?: () => void;
|
|
1036
1037
|
}
|
|
1037
1038
|
|
|
1038
1039
|
declare const Dropdown: {
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { FloatingPortal, autoUpdate, offset, autoPlacement } from '@floating-ui/
|
|
|
11
11
|
export { arrow, flip, hide, inline, offset, shift, size } from '@floating-ui/react';
|
|
12
12
|
import { useFloating } from '@floating-ui/react-dom';
|
|
13
13
|
import * as ShoplAssets from '@shoplflow/shopl-assets';
|
|
14
|
-
import { DownArrowSolidXsmallIcon, RightArrowSolidXsmallIcon, FirstPageIcon, LeftArrowIcon, RightArrowIcon, EndPageIcon, SearchIcon } from '@shoplflow/shopl-assets';
|
|
14
|
+
import { DeleteIcon, DownArrowSolidXsmallIcon, RightArrowSolidXsmallIcon, FirstPageIcon, LeftArrowIcon, RightArrowIcon, EndPageIcon, SearchIcon } from '@shoplflow/shopl-assets';
|
|
15
15
|
import { shift, flip, offset as offset$1 } from '@floating-ui/core';
|
|
16
16
|
import * as HadaAssets from '@shoplflow/hada-assets';
|
|
17
17
|
import DatePicker2 from 'react-datepicker';
|
|
@@ -3131,33 +3131,31 @@ var getDropdownFontSizeBySizeVar = (size2) => {
|
|
|
3131
3131
|
case "M":
|
|
3132
3132
|
return "body1_400";
|
|
3133
3133
|
case "S":
|
|
3134
|
-
return "
|
|
3134
|
+
return "body1_400";
|
|
3135
3135
|
default:
|
|
3136
3136
|
return "body1_400";
|
|
3137
3137
|
}
|
|
3138
3138
|
};
|
|
3139
3139
|
var getDropdownStyleBySizeVar = (size2) => {
|
|
3140
3140
|
switch (size2) {
|
|
3141
|
-
case "
|
|
3141
|
+
case "S":
|
|
3142
3142
|
return css`
|
|
3143
|
-
|
|
3144
|
-
padding: 8px 4px 8px 12px;
|
|
3143
|
+
padding: 0 8px;
|
|
3145
3144
|
`;
|
|
3146
3145
|
case "M":
|
|
3147
3146
|
return css`
|
|
3148
|
-
|
|
3149
|
-
gap: 4px;
|
|
3150
|
-
padding: 4px 4px 4px 12px;
|
|
3147
|
+
padding: 0 12px;
|
|
3151
3148
|
`;
|
|
3152
|
-
case "
|
|
3149
|
+
case "L":
|
|
3153
3150
|
return css`
|
|
3154
|
-
background-color:
|
|
3155
|
-
padding:
|
|
3156
|
-
|
|
3151
|
+
background-color: transparent;
|
|
3152
|
+
padding-left: 12px;
|
|
3153
|
+
padding-right: 6px;
|
|
3157
3154
|
`;
|
|
3158
3155
|
default:
|
|
3159
3156
|
return css`
|
|
3160
|
-
|
|
3157
|
+
background-color: ${colorTokens.neutral0};
|
|
3158
|
+
padding: 0 8px;
|
|
3161
3159
|
`;
|
|
3162
3160
|
}
|
|
3163
3161
|
};
|
|
@@ -3166,28 +3164,12 @@ var getDisabledStyle2 = (disabled) => {
|
|
|
3166
3164
|
return css`
|
|
3167
3165
|
cursor: not-allowed;
|
|
3168
3166
|
background: ${colorTokens.neutral100};
|
|
3167
|
+
svg > path {
|
|
3168
|
+
fill: ${colorTokens.neutral400} !important;
|
|
3169
|
+
}
|
|
3169
3170
|
`;
|
|
3170
3171
|
}
|
|
3171
3172
|
};
|
|
3172
|
-
var getDropdownIconSizeBySizeVar = (size2) => {
|
|
3173
|
-
switch (size2) {
|
|
3174
|
-
case "S":
|
|
3175
|
-
case "L":
|
|
3176
|
-
return css`
|
|
3177
|
-
height: 24px;
|
|
3178
|
-
width: 24px;
|
|
3179
|
-
min-width: 24px;
|
|
3180
|
-
min-height: 24px;
|
|
3181
|
-
`;
|
|
3182
|
-
default:
|
|
3183
|
-
return css`
|
|
3184
|
-
height: 32px;
|
|
3185
|
-
width: 32px;
|
|
3186
|
-
min-width: 32px;
|
|
3187
|
-
min-height: 32px;
|
|
3188
|
-
`;
|
|
3189
|
-
}
|
|
3190
|
-
};
|
|
3191
3173
|
var getBorderColorByStatus = ({ isFocused, isError, isHovered, disabled, sizeVar }) => {
|
|
3192
3174
|
if (!disabled) {
|
|
3193
3175
|
if (isError) {
|
|
@@ -3232,7 +3214,17 @@ var getStyleByType = ({
|
|
|
3232
3214
|
height: ${height || "initial"};
|
|
3233
3215
|
`;
|
|
3234
3216
|
};
|
|
3235
|
-
var
|
|
3217
|
+
var getClearIconHoverStyle = (hasValue) => {
|
|
3218
|
+
if (!hasValue) {
|
|
3219
|
+
return;
|
|
3220
|
+
}
|
|
3221
|
+
return css`
|
|
3222
|
+
&:hover .dropdown-clear-icon {
|
|
3223
|
+
display: flex;
|
|
3224
|
+
}
|
|
3225
|
+
`;
|
|
3226
|
+
};
|
|
3227
|
+
var StyledDropdownButtonWrapper = styled6.div`
|
|
3236
3228
|
position: relative;
|
|
3237
3229
|
display: flex;
|
|
3238
3230
|
align-items: center;
|
|
@@ -3250,33 +3242,63 @@ var StyledDropdownButtonWrapper = styled6.label`
|
|
|
3250
3242
|
width
|
|
3251
3243
|
})};
|
|
3252
3244
|
${(props) => getButtonWrapperStyleBySizeVar(props)};
|
|
3253
|
-
|
|
3254
3245
|
${({ disabled }) => getDisabledStyle2(disabled)};
|
|
3246
|
+
|
|
3247
|
+
${({ hasValue }) => getClearIconHoverStyle(hasValue)}
|
|
3255
3248
|
`;
|
|
3256
3249
|
var StyledDropdownButton = styled6.button`
|
|
3250
|
+
position: relative;
|
|
3257
3251
|
display: flex;
|
|
3258
3252
|
flex-direction: row;
|
|
3259
3253
|
align-items: center;
|
|
3260
3254
|
justify-content: space-between;
|
|
3261
3255
|
width: 100%;
|
|
3262
3256
|
height: 100%;
|
|
3263
|
-
|
|
3264
3257
|
cursor: pointer;
|
|
3258
|
+
|
|
3265
3259
|
${({ sizeVar }) => sizeVar && getDropdownStyleBySizeVar(sizeVar)};
|
|
3266
3260
|
${({ disabled }) => getDisabledStyle2(disabled)};
|
|
3261
|
+
|
|
3262
|
+
.dropdown-clear-icon {
|
|
3263
|
+
display: none;
|
|
3264
|
+
position: absolute;
|
|
3265
|
+
right: 0;
|
|
3266
|
+
}
|
|
3267
3267
|
`;
|
|
3268
|
-
var DropdownButtonIcon = styled6
|
|
3268
|
+
var DropdownButtonIcon = styled6.div`
|
|
3269
3269
|
display: flex;
|
|
3270
3270
|
align-items: center;
|
|
3271
|
-
justify-content: center;
|
|
3272
3271
|
flex-shrink: 0;
|
|
3272
|
+
min-width: 22px;
|
|
3273
|
+
height: 100%;
|
|
3273
3274
|
|
|
3274
|
-
${({ sizeVar }) => sizeVar && getDropdownIconSizeBySizeVar(sizeVar)};
|
|
3275
3275
|
${({ disabled }) => getDisabledStyle2(disabled)};
|
|
3276
3276
|
`;
|
|
3277
3277
|
var DropdownTriggerButton = forwardRef(
|
|
3278
3278
|
(_a, ref) => {
|
|
3279
|
-
var _b = _a, {
|
|
3279
|
+
var _b = _a, {
|
|
3280
|
+
width = "100%",
|
|
3281
|
+
onClick,
|
|
3282
|
+
sizeVar = "M",
|
|
3283
|
+
isError,
|
|
3284
|
+
placeholder,
|
|
3285
|
+
value,
|
|
3286
|
+
disabled,
|
|
3287
|
+
leftSource,
|
|
3288
|
+
rightSource,
|
|
3289
|
+
onClear
|
|
3290
|
+
} = _b, rest = __objRest(_b, [
|
|
3291
|
+
"width",
|
|
3292
|
+
"onClick",
|
|
3293
|
+
"sizeVar",
|
|
3294
|
+
"isError",
|
|
3295
|
+
"placeholder",
|
|
3296
|
+
"value",
|
|
3297
|
+
"disabled",
|
|
3298
|
+
"leftSource",
|
|
3299
|
+
"rightSource",
|
|
3300
|
+
"onClear"
|
|
3301
|
+
]);
|
|
3280
3302
|
const { isOpen, setIsOpen } = useDropdown();
|
|
3281
3303
|
const [isHovered, setIsHovered] = useState(false);
|
|
3282
3304
|
const handleOnClick = (e) => {
|
|
@@ -3291,6 +3313,10 @@ var DropdownTriggerButton = forwardRef(
|
|
|
3291
3313
|
const handleOnMouseLeave = () => {
|
|
3292
3314
|
setIsHovered(false);
|
|
3293
3315
|
};
|
|
3316
|
+
const handleOnClear = (e) => {
|
|
3317
|
+
e.stopPropagation();
|
|
3318
|
+
onClear && onClear();
|
|
3319
|
+
};
|
|
3294
3320
|
const getTextColor = ({ value: value2, disabled: disabled2 }) => {
|
|
3295
3321
|
if (disabled2) {
|
|
3296
3322
|
return "neutral350";
|
|
@@ -3301,7 +3327,8 @@ var DropdownTriggerButton = forwardRef(
|
|
|
3301
3327
|
return "neutral700";
|
|
3302
3328
|
};
|
|
3303
3329
|
const LeftSourceClone = leftSource ? cloneElement(leftSource, __spreadProps(__spreadValues({}, leftSource.props), { disabled })) : leftSource;
|
|
3304
|
-
|
|
3330
|
+
const RightSourceClone = rightSource ? cloneElement(rightSource, __spreadProps(__spreadValues({}, rightSource.props), { disabled })) : rightSource;
|
|
3331
|
+
return /* @__PURE__ */ jsxs(
|
|
3305
3332
|
StyledDropdownButtonWrapper,
|
|
3306
3333
|
{
|
|
3307
3334
|
onMouseEnter: handleOnMouseEnter,
|
|
@@ -3313,24 +3340,39 @@ var DropdownTriggerButton = forwardRef(
|
|
|
3313
3340
|
isError,
|
|
3314
3341
|
sizeVar,
|
|
3315
3342
|
height: getDropdownHeightBySizeVar(sizeVar),
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
lineClamp: 1,
|
|
3326
|
-
children: placeholder
|
|
3327
|
-
}
|
|
3328
|
-
)
|
|
3329
|
-
] }),
|
|
3330
|
-
/* @__PURE__ */ jsx(
|
|
3331
|
-
DropdownButtonIcon,
|
|
3332
|
-
{
|
|
3343
|
+
hasValue: Boolean(value),
|
|
3344
|
+
children: [
|
|
3345
|
+
/* @__PURE__ */ jsxs(
|
|
3346
|
+
StyledDropdownButton,
|
|
3347
|
+
__spreadProps(__spreadValues({
|
|
3348
|
+
ref,
|
|
3349
|
+
onClick: handleOnClick,
|
|
3350
|
+
disabled
|
|
3351
|
+
}, rest), {
|
|
3333
3352
|
sizeVar,
|
|
3353
|
+
"data-shoplflow": "Dropdown-Content-Area",
|
|
3354
|
+
children: [
|
|
3355
|
+
/* @__PURE__ */ jsxs(Stack_default.Horizontal, { width: "100%", spacing: "spacing04", align: "center", children: [
|
|
3356
|
+
LeftSourceClone && LeftSourceClone,
|
|
3357
|
+
value || /* @__PURE__ */ jsx(
|
|
3358
|
+
Text_default,
|
|
3359
|
+
{
|
|
3360
|
+
typography: getDropdownFontSizeBySizeVar(sizeVar),
|
|
3361
|
+
color: getTextColor({ value, disabled }),
|
|
3362
|
+
textOverflow: "ellipsis",
|
|
3363
|
+
lineClamp: 1,
|
|
3364
|
+
children: placeholder
|
|
3365
|
+
}
|
|
3366
|
+
)
|
|
3367
|
+
] }),
|
|
3368
|
+
onClear && sizeVar !== "L" && /* @__PURE__ */ jsx(IconButton_default, { sizeVar, styleVar: "GHOST", onClick: handleOnClear, className: "dropdown-clear-icon", children: /* @__PURE__ */ jsx(Icon_default, { iconSource: DeleteIcon, color: "neutral350", sizeVar: "S" }) })
|
|
3369
|
+
]
|
|
3370
|
+
})
|
|
3371
|
+
),
|
|
3372
|
+
RightSourceClone && /* @__PURE__ */ jsx(StackContainer_default, { padding: "0 6px 0 0", children: RightSourceClone }),
|
|
3373
|
+
/* @__PURE__ */ jsx(DropdownButtonIcon, { sizeVar, "data-shoplflow": "Dropdown-Button-Icon-Area", children: /* @__PURE__ */ jsx(
|
|
3374
|
+
motion.div,
|
|
3375
|
+
{
|
|
3334
3376
|
animate: {
|
|
3335
3377
|
rotate: isOpen ? 180 : 0
|
|
3336
3378
|
},
|
|
@@ -3346,8 +3388,8 @@ var DropdownTriggerButton = forwardRef(
|
|
|
3346
3388
|
}
|
|
3347
3389
|
)
|
|
3348
3390
|
}
|
|
3349
|
-
)
|
|
3350
|
-
]
|
|
3391
|
+
) })
|
|
3392
|
+
]
|
|
3351
3393
|
}
|
|
3352
3394
|
);
|
|
3353
3395
|
}
|