@shoplflow/base 0.23.0 → 0.23.1

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 CHANGED
@@ -2737,6 +2737,95 @@ var TextArea = React3.forwardRef(
2737
2737
  }
2738
2738
  );
2739
2739
  exports.TextArea = TextArea;
2740
+ var StyledSelectInputButton = styled6__default.default.div`
2741
+ display: flex;
2742
+ flex-direction: row;
2743
+ align-items: center;
2744
+ justify-content: space-between;
2745
+ width: 100%;
2746
+ background: ${exports.colorTokens.neutral0};
2747
+ gap: 4px;
2748
+ padding: 4px 4px 4px 12px;
2749
+ cursor: pointer;
2750
+ ${({ disabled }) => disabled && react$1.css`
2751
+ background-color: ${exports.colorTokens.neutral100};
2752
+ cursor: not-allowed;
2753
+ `}
2754
+ `;
2755
+ var SelectInputButton = (_a) => {
2756
+ var _b = _a, {
2757
+ disabled,
2758
+ isSelected,
2759
+ onMouseEnter,
2760
+ onMouseLeave,
2761
+ onClick,
2762
+ onClear,
2763
+ value,
2764
+ placeholder,
2765
+ label,
2766
+ width,
2767
+ rightSource
2768
+ } = _b, rest = __objRest(_b, [
2769
+ "disabled",
2770
+ "isSelected",
2771
+ "onMouseEnter",
2772
+ "onMouseLeave",
2773
+ "onClick",
2774
+ "onClear",
2775
+ "value",
2776
+ "placeholder",
2777
+ "label",
2778
+ "width",
2779
+ "rightSource"
2780
+ ]);
2781
+ const [isHovered, setIsHovered] = React3.useState(false);
2782
+ const handleOnClick = (e) => {
2783
+ e.preventDefault();
2784
+ if (!disabled) {
2785
+ onClick && onClick(e);
2786
+ }
2787
+ };
2788
+ const handleOnClear = (e) => {
2789
+ e.stopPropagation();
2790
+ if (!disabled) {
2791
+ onClear && onClear(e);
2792
+ }
2793
+ };
2794
+ const handleOnMouseEnter = (e) => {
2795
+ setIsHovered(true);
2796
+ onMouseEnter && onMouseEnter(e);
2797
+ };
2798
+ const handleOnMouseLeave = (e) => {
2799
+ setIsHovered(false);
2800
+ onMouseLeave && onMouseLeave(e);
2801
+ };
2802
+ return /* @__PURE__ */ jsxRuntime.jsx(
2803
+ InputWrapper,
2804
+ __spreadProps(__spreadValues({
2805
+ onMouseEnter: handleOnMouseEnter,
2806
+ onMouseLeave: handleOnMouseLeave,
2807
+ onClick: handleOnClick,
2808
+ isHovered,
2809
+ isFocused: isSelected,
2810
+ disabled,
2811
+ width
2812
+ }, rest), {
2813
+ "data-shoplflow": "SelectInputButton",
2814
+ children: /* @__PURE__ */ jsxRuntime.jsxs(StyledSelectInputButton, { children: [
2815
+ value && value.length > 0 && label ? /* @__PURE__ */ jsxRuntime.jsx(exports.Text, { typography: "body1_400", children: value[0][label] }) : /* @__PURE__ */ jsxRuntime.jsx(exports.Text, { typography: "body1_400", color: "neutral350", children: placeholder }),
2816
+ /* @__PURE__ */ jsxRuntime.jsxs(exports.Stack.Horizontal, { align: "center", children: [
2817
+ value && value.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs(exports.Text, { typography: "body1_400", color: "neutral700", children: [
2818
+ "+",
2819
+ value.length - 1
2820
+ ] }),
2821
+ value && value.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(exports.IconButton, { sizeVar: "S", onClick: handleOnClear, styleVar: "GHOST", disabled, children: /* @__PURE__ */ jsxRuntime.jsx(exports.Icon, { iconSource: assetFunction("DeleteIcon"), color: "neutral350" }) }),
2822
+ rightSource
2823
+ ] })
2824
+ ] })
2825
+ })
2826
+ );
2827
+ };
2828
+ exports.SelectInputButton = SelectInputButton;
2740
2829
  var Container2 = styled6__default.default.div`
2741
2830
  width: 32px;
2742
2831
  height: 32px;