@shoplflow/base 0.24.4 → 0.24.6

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
@@ -2021,6 +2021,286 @@ var Dropdown = ({
2021
2021
  Dropdown.Button = DropdownButton;
2022
2022
  Dropdown.Content = DropdownContent;
2023
2023
  exports.Dropdown = Dropdown;
2024
+ var Container2 = styled6__default.default.div`
2025
+ width: 32px;
2026
+ height: 32px;
2027
+ padding: 7px;
2028
+ `;
2029
+ var IconButton2 = styled6__default.default.button`
2030
+ display: flex;
2031
+ width: 16px;
2032
+ height: 16px;
2033
+ flex-direction: column;
2034
+ justify-content: center;
2035
+ align-items: center;
2036
+ border-radius: ${exports.borderRadiusTokens.borderRadius04};
2037
+ border: none;
2038
+ background: ${({ color }) => exports.colorTokens[color]};
2039
+ cursor: pointer;
2040
+ transition:
2041
+ transform 0.1s ease-out,
2042
+ background 0.1s ease;
2043
+
2044
+ &:hover {
2045
+ background: ${({ color }) => exports.colorTokens[getNextColor(color, 1)]};
2046
+ }
2047
+ `;
2048
+ var MUNUS_BUTTON_SYMBOL_KEY = Symbol("SHOPLFLOW_MUNUS_BUTTON");
2049
+ var MinusButton = React3.forwardRef((_a, ref) => {
2050
+ var _b = _a, { onClick, color = "neutral300" } = _b, rest = __objRest(_b, ["onClick", "color"]);
2051
+ return /* @__PURE__ */ jsxRuntime.jsx(Container2, { "data-shoplflow": "minusButton", children: /* @__PURE__ */ jsxRuntime.jsx(IconButton2, __spreadProps(__spreadValues({ color, onClick, ref }, rest), { children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
2052
+ /* @__PURE__ */ jsxRuntime.jsx(
2053
+ "path",
2054
+ {
2055
+ d: "M0 4C0 1.79086 1.79086 0 4 0H12C14.2091 0 16 1.79086 16 4V12C16 14.2091 14.2091 16 12 16H4C1.79086 16 0 14.2091 0 12V4Z",
2056
+ fill: "none"
2057
+ }
2058
+ ),
2059
+ /* @__PURE__ */ jsxRuntime.jsx(
2060
+ "path",
2061
+ {
2062
+ fillRule: "evenodd",
2063
+ clipRule: "evenodd",
2064
+ d: "M3 8C3 7.44772 3.44772 7 4 7H12C12.5523 7 13 7.44772 13 8C13 8.55228 12.5523 9 12 9H4C3.44772 9 3 8.55228 3 8Z",
2065
+ fill: "white"
2066
+ }
2067
+ )
2068
+ ] }) })) });
2069
+ });
2070
+ MinusButton[MUNUS_BUTTON_SYMBOL_KEY] = true;
2071
+ exports.MinusButton = MinusButton;
2072
+ var getStylesByStyleVariant = (styleVariant, isSelected, isHovered) => {
2073
+ switch (styleVariant) {
2074
+ case "PRIMARY":
2075
+ if (isSelected) {
2076
+ return react$1.css`
2077
+ background: ${exports.colorTokens.primary300};
2078
+ border: 1.5px solid ${exports.colorTokens.primary300};
2079
+ & > svg > path {
2080
+ fill: ${exports.colorTokens.neutral0};
2081
+ }
2082
+ ${isHovered && react$1.css`
2083
+ border: 1.5px solid ${exports.colorTokens.primary400};
2084
+ background: ${exports.colorTokens.primary400};
2085
+ `}
2086
+ `;
2087
+ }
2088
+ return react$1.css`
2089
+ background: ${exports.colorTokens.neutral200};
2090
+ border: 1.5px solid ${exports.colorTokens.neutral200};
2091
+ border-radius: 4px;
2092
+ ${isHovered && react$1.css`
2093
+ border: 1.5px solid ${exports.colorTokens.neutral300};
2094
+ background: ${exports.colorTokens.neutral300};
2095
+ `}
2096
+
2097
+ & > svg > path {
2098
+ fill: ${exports.colorTokens.neutral0};
2099
+ }
2100
+ `;
2101
+ case "LINE":
2102
+ if (isSelected) {
2103
+ return react$1.css`
2104
+ border: 1.5px solid ${exports.colorTokens.primary300};
2105
+ background: transparent;
2106
+ border-radius: 4px;
2107
+ & > svg > path {
2108
+ fill: ${exports.colorTokens.primary300};
2109
+ }
2110
+ ${isHovered && react$1.css`
2111
+ border: 1.5px solid ${exports.colorTokens.primary400};
2112
+ & > svg > path {
2113
+ fill: ${exports.colorTokens.primary400};
2114
+ }
2115
+ `}
2116
+ `;
2117
+ }
2118
+ return react$1.css`
2119
+ background: transparent;
2120
+ border: 1.5px solid ${exports.colorTokens.neutral200};
2121
+ border-radius: 4px;
2122
+ & > svg > path {
2123
+ fill: ${exports.colorTokens.neutral200};
2124
+ }
2125
+ ${isHovered && react$1.css`
2126
+ border: 1.5px solid ${exports.colorTokens.neutral300};
2127
+ & > svg > path {
2128
+ fill: ${exports.colorTokens.neutral300};
2129
+ }
2130
+ `}
2131
+ `;
2132
+ default:
2133
+ return "";
2134
+ }
2135
+ };
2136
+ var StyledCheckbox = styled6__default.default.button`
2137
+ display: flex;
2138
+ align-items: center;
2139
+ justify-content: center;
2140
+ min-width: 16px;
2141
+ min-height: 16px;
2142
+ width: 16px;
2143
+ height: 16px;
2144
+ background: ${exports.colorTokens.neutral200};
2145
+ border-radius: 4px;
2146
+ box-sizing: border-box;
2147
+ cursor: pointer;
2148
+ ${({ styleVar, isSelected, isHovered }) => getStylesByStyleVariant(styleVar, isSelected, isHovered)};
2149
+ ${({ disabled }) => getDisabledStyle(disabled)}
2150
+ `;
2151
+ var Container3 = styled6__default.default.button`
2152
+ display: flex;
2153
+ align-items: center;
2154
+ justify-content: center;
2155
+ padding: 4px;
2156
+ width: fit-content;
2157
+ height: fit-content;
2158
+ background-color: transparent;
2159
+ `;
2160
+ exports.CHECKBOX_SYMBOL_KEY = Symbol("SHOPLFLOW_CHECKBOX");
2161
+ var Checkbox = (_a) => {
2162
+ var _b = _a, {
2163
+ defaultSelected,
2164
+ isSelected,
2165
+ disabled,
2166
+ onClick,
2167
+ onMouseEnter,
2168
+ onMouseLeave,
2169
+ styleVar = "PRIMARY"
2170
+ } = _b, rest = __objRest(_b, [
2171
+ "defaultSelected",
2172
+ "isSelected",
2173
+ "disabled",
2174
+ "onClick",
2175
+ "onMouseEnter",
2176
+ "onMouseLeave",
2177
+ "styleVar"
2178
+ ]);
2179
+ const [selected, toggleSelected] = useOnToggle(isSelected, defaultSelected);
2180
+ const [isHovered, toggleHovered] = React3.useState(false);
2181
+ const handleMouseLeave = (e) => {
2182
+ toggleHovered(false);
2183
+ onMouseLeave && onMouseLeave(e);
2184
+ };
2185
+ const handleMouseEnter = (e) => {
2186
+ toggleHovered(true);
2187
+ onMouseEnter && onMouseEnter(e);
2188
+ };
2189
+ const handleClick = (e) => {
2190
+ if (disabled) {
2191
+ return;
2192
+ }
2193
+ onClick && onClick(e);
2194
+ toggleSelected();
2195
+ };
2196
+ return /* @__PURE__ */ jsxRuntime.jsx(
2197
+ Container3,
2198
+ __spreadProps(__spreadValues({
2199
+ onClick: handleClick,
2200
+ onMouseLeave: handleMouseLeave,
2201
+ onMouseEnter: handleMouseEnter,
2202
+ disabled
2203
+ }, rest), {
2204
+ "data-shoplflow": "Checkbox",
2205
+ children: /* @__PURE__ */ jsxRuntime.jsx(StyledCheckbox, { styleVar, isHovered, isSelected: selected, disabled, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "8", viewBox: "0 0 12 8", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
2206
+ "path",
2207
+ {
2208
+ fillRule: "evenodd",
2209
+ clipRule: "evenodd",
2210
+ d: "M9.78822 0.297596C10.1761 -0.0955083 10.8093 -0.0997053 11.2024 0.288222C11.5653 0.646308 11.5968 1.21334 11.2943 1.60765L11.2118 1.7024L5.31714 7.7024C4.95248 8.07193 4.37282 8.09687 3.97909 7.77976L3.88476 7.69335L0.779404 4.42669C0.396475 4.02871 0.408672 3.39567 0.806647 3.01274C1.17401 2.65926 1.74167 2.64247 2.12801 2.95499L2.2206 3.03998L4.614 5.567L9.78822 0.297596Z",
2211
+ fill: "white"
2212
+ }
2213
+ ) }) })
2214
+ })
2215
+ );
2216
+ };
2217
+ Checkbox[exports.CHECKBOX_SYMBOL_KEY] = true;
2218
+ exports.Checkbox = Checkbox;
2219
+
2220
+ // src/components/ControlButtons/Checkbox/Checkbox.types.ts
2221
+ exports.CheckboxStyleVariants = {
2222
+ PRIMARY: "PRIMARY",
2223
+ LINE: "LINE"
2224
+ };
2225
+ var getSelectedStyle = (isHovered) => {
2226
+ return react$1.css`
2227
+ & > svg > circle {
2228
+ stroke: ${exports.colorTokens.primary300};
2229
+ }
2230
+ ${isHovered && react$1.css`
2231
+ & > svg > circle {
2232
+ stroke: ${exports.colorTokens.primary400};
2233
+ }
2234
+ `}
2235
+ `;
2236
+ };
2237
+ var StyledRadio = styled6__default.default.div`
2238
+ display: flex;
2239
+ align-items: center;
2240
+ justify-content: center;
2241
+ min-width: 16px;
2242
+ min-height: 16px;
2243
+ width: 16px;
2244
+ height: 16px;
2245
+ ${({ isHovered }) => react$1.css`
2246
+ & > svg > circle {
2247
+ stroke: ${exports.colorTokens.neutral200};
2248
+ }
2249
+ ${isHovered && react$1.css`
2250
+ & > svg > circle {
2251
+ stroke: ${exports.colorTokens.neutral300};
2252
+ }
2253
+ `}
2254
+ `}
2255
+ cursor: pointer;
2256
+ ${({ isSelected, isHovered }) => isSelected && getSelectedStyle(isHovered)}
2257
+ ${({ disabled }) => getDisabledStyle(disabled)}
2258
+ `;
2259
+ var Container4 = styled6__default.default.button`
2260
+ display: flex;
2261
+ align-items: center;
2262
+ justify-content: center;
2263
+ background: transparent;
2264
+ padding: 4px;
2265
+ width: fit-content;
2266
+ height: fit-content;
2267
+ `;
2268
+ exports.RADIO_SYMBOL_KEY = Symbol("SHOPLFLOW_RADIO");
2269
+ var Radio = (_a) => {
2270
+ var _b = _a, { isSelected, defaultSelected, disabled, onClick, onMouseEnter, onMouseLeave } = _b, rest = __objRest(_b, ["isSelected", "defaultSelected", "disabled", "onClick", "onMouseEnter", "onMouseLeave"]);
2271
+ const [selected, toggleSelected] = useOnToggle(isSelected, defaultSelected);
2272
+ const [isHovered, toggleHovered] = React3.useState(false);
2273
+ const handleMouseLeave = (e) => {
2274
+ toggleHovered(false);
2275
+ onMouseLeave && onMouseLeave(e);
2276
+ };
2277
+ const handleMouseEnter = (e) => {
2278
+ toggleHovered(true);
2279
+ onMouseEnter && onMouseEnter(e);
2280
+ };
2281
+ const handleClick = (e) => {
2282
+ if (disabled) {
2283
+ return;
2284
+ }
2285
+ onClick && onClick(e);
2286
+ toggleSelected();
2287
+ };
2288
+ return /* @__PURE__ */ jsxRuntime.jsx(
2289
+ Container4,
2290
+ __spreadProps(__spreadValues({
2291
+ onClick: handleClick,
2292
+ onMouseEnter: handleMouseEnter,
2293
+ onMouseLeave: handleMouseLeave
2294
+ }, rest), {
2295
+ "data-shoplflow": "Radio",
2296
+ children: /* @__PURE__ */ jsxRuntime.jsx(StyledRadio, { isSelected: selected, isHovered, disabled, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8", cy: "8", r: "5.5", fill: "white", stroke: "#3299FE", strokeWidth: "5" }) }) })
2297
+ })
2298
+ );
2299
+ };
2300
+ Radio[exports.RADIO_SYMBOL_KEY] = true;
2301
+ exports.Radio = Radio;
2302
+
2303
+ // src/components/Menu/Menu.styled.ts
2024
2304
  var getStylesBySizeVar = (sizeVar) => {
2025
2305
  switch (sizeVar) {
2026
2306
  case "XS":
@@ -2068,7 +2348,7 @@ exports.StyledMenu = styled6__default.default.li`
2068
2348
  background: ${exports.colorTokens.neutral400_5};
2069
2349
  }
2070
2350
  ${({ disabled }) => disabled && getDisabledStyle(disabled)}
2071
- ${({ isSelected, leftSource }) => isSelected === true && !leftSource && react$1.css`
2351
+ ${({ isSelected, leftSource }) => isSelected === true && (!leftSource || leftSource && !leftSource.type[exports.RADIO_SYMBOL_KEY] && !leftSource.type[exports.CHECKBOX_SYMBOL_KEY] && !leftSource.type[MUNUS_BUTTON_SYMBOL_KEY]) && react$1.css`
2072
2352
  background: ${exports.colorTokens.neutral200};
2073
2353
  &:hover {
2074
2354
  background: ${exports.colorTokens.neutral200};
@@ -2709,416 +2989,145 @@ var TextArea = React3.forwardRef(
2709
2989
  }, [defaultValue, maxLength]);
2710
2990
  React3.useEffect(() => {
2711
2991
  if (value) {
2712
- const convertString = convertToString(value);
2713
- if (maxLength && convertString.length > maxLength) {
2714
- setText(convertString);
2715
- }
2716
- setText(convertToString(value));
2717
- }
2718
- }, [maxLength, value]);
2719
- const uniqueId = React3.useId();
2720
- return /* @__PURE__ */ jsxRuntime.jsxs(
2721
- InputWrapper,
2722
- {
2723
- htmlFor: uniqueId,
2724
- isFocused,
2725
- disabled,
2726
- isHovered,
2727
- isError,
2728
- direction: "column",
2729
- onMouseEnter: handleOnMouseEnter,
2730
- onMouseLeave: handleOnMouseLeave,
2731
- width,
2732
- "data-shoplflow": "text-area",
2733
- children: [
2734
- /* @__PURE__ */ jsxRuntime.jsx(
2735
- StyledTextarea,
2736
- __spreadValues({
2737
- className: "body1_400" + (className ? ` ${className}` : ""),
2738
- placeholder,
2739
- onFocus: handleOnFocus,
2740
- onBlur: handleOnBlur,
2741
- onChange: handleOnChange,
2742
- name,
2743
- id: uniqueId,
2744
- value,
2745
- ref,
2746
- maxLength,
2747
- disabled,
2748
- minHeight
2749
- }, rest)
2750
- ),
2751
- /* @__PURE__ */ jsxRuntime.jsx(BottomElementWrapper, { children: maxLength && /* @__PURE__ */ jsxRuntime.jsx(TextCounter_default, { currentLength: String(text).length, maxLength }) })
2752
- ]
2753
- }
2754
- );
2755
- }
2756
- );
2757
- exports.TextArea = TextArea;
2758
- var StyledSelectInputButton = styled6__default.default.div`
2759
- display: flex;
2760
- flex-direction: row;
2761
- align-items: center;
2762
- justify-content: space-between;
2763
- width: 100%;
2764
- background: ${exports.colorTokens.neutral0};
2765
- gap: 4px;
2766
- padding: 4px 4px 4px 12px;
2767
- cursor: pointer;
2768
- ${({ disabled }) => disabled && react$1.css`
2769
- background-color: ${exports.colorTokens.neutral100};
2770
- cursor: not-allowed;
2771
- `}
2772
- `;
2773
- var SelectInputButton = (_a) => {
2774
- var _b = _a, {
2775
- disabled,
2776
- isSelected,
2777
- onMouseEnter,
2778
- onMouseLeave,
2779
- onClick,
2780
- onClear,
2781
- value,
2782
- placeholder,
2783
- label,
2784
- width,
2785
- rightSource
2786
- } = _b, rest = __objRest(_b, [
2787
- "disabled",
2788
- "isSelected",
2789
- "onMouseEnter",
2790
- "onMouseLeave",
2791
- "onClick",
2792
- "onClear",
2793
- "value",
2794
- "placeholder",
2795
- "label",
2796
- "width",
2797
- "rightSource"
2798
- ]);
2799
- const [isHovered, setIsHovered] = React3.useState(false);
2800
- const handleOnClick = (e) => {
2801
- e.preventDefault();
2802
- e.stopPropagation();
2803
- if (!disabled) {
2804
- onClick && onClick(e);
2805
- }
2806
- };
2807
- const handleOnClear = (e) => {
2808
- e.preventDefault();
2809
- e.stopPropagation();
2810
- if (!disabled) {
2811
- onClear && onClear(e);
2812
- }
2813
- };
2814
- const handleOnMouseEnter = (e) => {
2815
- setIsHovered(true);
2816
- onMouseEnter && onMouseEnter(e);
2817
- };
2818
- const handleOnMouseLeave = (e) => {
2819
- setIsHovered(false);
2820
- onMouseLeave && onMouseLeave(e);
2821
- };
2822
- return /* @__PURE__ */ jsxRuntime.jsx(
2823
- InputWrapper,
2824
- __spreadProps(__spreadValues({
2825
- onMouseEnter: handleOnMouseEnter,
2826
- onMouseLeave: handleOnMouseLeave,
2827
- onClick: handleOnClick,
2828
- isHovered,
2829
- isFocused: isSelected,
2830
- disabled,
2831
- width
2832
- }, rest), {
2833
- "data-shoplflow": "SelectInputButton",
2834
- children: /* @__PURE__ */ jsxRuntime.jsxs(StyledSelectInputButton, { children: [
2835
- 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 }),
2836
- /* @__PURE__ */ jsxRuntime.jsxs(exports.Stack.Horizontal, { align: "center", spacing: "spacing04", children: [
2837
- value && value.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs(exports.Text, { typography: "body1_400", color: "neutral700", children: [
2838
- "+",
2839
- value.length - 1
2840
- ] }),
2841
- /* @__PURE__ */ jsxRuntime.jsxs(exports.Stack.Horizontal, { align: "center", children: [
2842
- 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" }) }),
2843
- rightSource
2844
- ] })
2845
- ] })
2846
- ] })
2847
- })
2848
- );
2849
- };
2850
- exports.SelectInputButton = SelectInputButton;
2851
- var Container2 = styled6__default.default.div`
2852
- width: 32px;
2853
- height: 32px;
2854
- padding: 7px;
2855
- `;
2856
- var IconButton2 = styled6__default.default.button`
2857
- display: flex;
2858
- width: 16px;
2859
- height: 16px;
2860
- flex-direction: column;
2861
- justify-content: center;
2862
- align-items: center;
2863
- border-radius: ${exports.borderRadiusTokens.borderRadius04};
2864
- border: none;
2865
- background: ${({ color }) => exports.colorTokens[color]};
2866
- cursor: pointer;
2867
- transition:
2868
- transform 0.1s ease-out,
2869
- background 0.1s ease;
2870
-
2871
- &:hover {
2872
- background: ${({ color }) => exports.colorTokens[getNextColor(color, 1)]};
2873
- }
2874
- `;
2875
- var MinusButton = React3.forwardRef((_a, ref) => {
2876
- var _b = _a, { onClick, color = "neutral300" } = _b, rest = __objRest(_b, ["onClick", "color"]);
2877
- return /* @__PURE__ */ jsxRuntime.jsx(Container2, { "data-shoplflow": "minusButton", children: /* @__PURE__ */ jsxRuntime.jsx(IconButton2, __spreadProps(__spreadValues({ color, onClick, ref }, rest), { children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
2878
- /* @__PURE__ */ jsxRuntime.jsx(
2879
- "path",
2880
- {
2881
- d: "M0 4C0 1.79086 1.79086 0 4 0H12C14.2091 0 16 1.79086 16 4V12C16 14.2091 14.2091 16 12 16H4C1.79086 16 0 14.2091 0 12V4Z",
2882
- fill: "none"
2883
- }
2884
- ),
2885
- /* @__PURE__ */ jsxRuntime.jsx(
2886
- "path",
2887
- {
2888
- fillRule: "evenodd",
2889
- clipRule: "evenodd",
2890
- d: "M3 8C3 7.44772 3.44772 7 4 7H12C12.5523 7 13 7.44772 13 8C13 8.55228 12.5523 9 12 9H4C3.44772 9 3 8.55228 3 8Z",
2891
- fill: "white"
2892
- }
2893
- )
2894
- ] }) })) });
2895
- });
2896
- exports.MinusButton = MinusButton;
2897
- var getStylesByStyleVariant = (styleVariant, isSelected, isHovered) => {
2898
- switch (styleVariant) {
2899
- case "PRIMARY":
2900
- if (isSelected) {
2901
- return react$1.css`
2902
- background: ${exports.colorTokens.primary300};
2903
- border: 1.5px solid ${exports.colorTokens.primary300};
2904
- & > svg > path {
2905
- fill: ${exports.colorTokens.neutral0};
2906
- }
2907
- ${isHovered && react$1.css`
2908
- border: 1.5px solid ${exports.colorTokens.primary400};
2909
- background: ${exports.colorTokens.primary400};
2910
- `}
2911
- `;
2912
- }
2913
- return react$1.css`
2914
- background: ${exports.colorTokens.neutral200};
2915
- border: 1.5px solid ${exports.colorTokens.neutral200};
2916
- border-radius: 4px;
2917
- ${isHovered && react$1.css`
2918
- border: 1.5px solid ${exports.colorTokens.neutral300};
2919
- background: ${exports.colorTokens.neutral300};
2920
- `}
2921
-
2922
- & > svg > path {
2923
- fill: ${exports.colorTokens.neutral0};
2924
- }
2925
- `;
2926
- case "LINE":
2927
- if (isSelected) {
2928
- return react$1.css`
2929
- border: 1.5px solid ${exports.colorTokens.primary300};
2930
- background: transparent;
2931
- border-radius: 4px;
2932
- & > svg > path {
2933
- fill: ${exports.colorTokens.primary300};
2934
- }
2935
- ${isHovered && react$1.css`
2936
- border: 1.5px solid ${exports.colorTokens.primary400};
2937
- & > svg > path {
2938
- fill: ${exports.colorTokens.primary400};
2939
- }
2940
- `}
2941
- `;
2942
- }
2943
- return react$1.css`
2944
- background: transparent;
2945
- border: 1.5px solid ${exports.colorTokens.neutral200};
2946
- border-radius: 4px;
2947
- & > svg > path {
2948
- fill: ${exports.colorTokens.neutral200};
2992
+ const convertString = convertToString(value);
2993
+ if (maxLength && convertString.length > maxLength) {
2994
+ setText(convertString);
2949
2995
  }
2950
- ${isHovered && react$1.css`
2951
- border: 1.5px solid ${exports.colorTokens.neutral300};
2952
- & > svg > path {
2953
- fill: ${exports.colorTokens.neutral300};
2954
- }
2955
- `}
2956
- `;
2957
- default:
2958
- return "";
2996
+ setText(convertToString(value));
2997
+ }
2998
+ }, [maxLength, value]);
2999
+ const uniqueId = React3.useId();
3000
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3001
+ InputWrapper,
3002
+ {
3003
+ htmlFor: uniqueId,
3004
+ isFocused,
3005
+ disabled,
3006
+ isHovered,
3007
+ isError,
3008
+ direction: "column",
3009
+ onMouseEnter: handleOnMouseEnter,
3010
+ onMouseLeave: handleOnMouseLeave,
3011
+ width,
3012
+ "data-shoplflow": "text-area",
3013
+ children: [
3014
+ /* @__PURE__ */ jsxRuntime.jsx(
3015
+ StyledTextarea,
3016
+ __spreadValues({
3017
+ className: "body1_400" + (className ? ` ${className}` : ""),
3018
+ placeholder,
3019
+ onFocus: handleOnFocus,
3020
+ onBlur: handleOnBlur,
3021
+ onChange: handleOnChange,
3022
+ name,
3023
+ id: uniqueId,
3024
+ value,
3025
+ ref,
3026
+ maxLength,
3027
+ disabled,
3028
+ minHeight
3029
+ }, rest)
3030
+ ),
3031
+ /* @__PURE__ */ jsxRuntime.jsx(BottomElementWrapper, { children: maxLength && /* @__PURE__ */ jsxRuntime.jsx(TextCounter_default, { currentLength: String(text).length, maxLength }) })
3032
+ ]
3033
+ }
3034
+ );
2959
3035
  }
2960
- };
2961
- var StyledCheckbox = styled6__default.default.button`
3036
+ );
3037
+ exports.TextArea = TextArea;
3038
+ var StyledSelectInputButton = styled6__default.default.div`
2962
3039
  display: flex;
3040
+ flex-direction: row;
2963
3041
  align-items: center;
2964
- justify-content: center;
2965
- min-width: 16px;
2966
- min-height: 16px;
2967
- width: 16px;
2968
- height: 16px;
2969
- background: ${exports.colorTokens.neutral200};
2970
- border-radius: 4px;
2971
- box-sizing: border-box;
3042
+ justify-content: space-between;
3043
+ width: 100%;
3044
+ background: ${exports.colorTokens.neutral0};
3045
+ gap: 4px;
3046
+ padding: 4px 4px 4px 12px;
2972
3047
  cursor: pointer;
2973
- ${({ styleVar, isSelected, isHovered }) => getStylesByStyleVariant(styleVar, isSelected, isHovered)};
2974
- ${({ disabled }) => getDisabledStyle(disabled)}
2975
- `;
2976
- var Container3 = styled6__default.default.button`
2977
- display: flex;
2978
- align-items: center;
2979
- justify-content: center;
2980
- padding: 4px;
2981
- width: fit-content;
2982
- height: fit-content;
3048
+ ${({ disabled }) => disabled && react$1.css`
3049
+ background-color: ${exports.colorTokens.neutral100};
3050
+ cursor: not-allowed;
3051
+ `}
2983
3052
  `;
2984
- var Checkbox = (_a) => {
3053
+ var SelectInputButton = (_a) => {
2985
3054
  var _b = _a, {
2986
- defaultSelected,
2987
- isSelected,
2988
3055
  disabled,
2989
- onClick,
3056
+ isSelected,
2990
3057
  onMouseEnter,
2991
3058
  onMouseLeave,
2992
- styleVar = "PRIMARY"
3059
+ onClick,
3060
+ onClear,
3061
+ value,
3062
+ placeholder,
3063
+ label,
3064
+ width,
3065
+ rightSource
2993
3066
  } = _b, rest = __objRest(_b, [
2994
- "defaultSelected",
2995
- "isSelected",
2996
3067
  "disabled",
2997
- "onClick",
3068
+ "isSelected",
2998
3069
  "onMouseEnter",
2999
3070
  "onMouseLeave",
3000
- "styleVar"
3071
+ "onClick",
3072
+ "onClear",
3073
+ "value",
3074
+ "placeholder",
3075
+ "label",
3076
+ "width",
3077
+ "rightSource"
3001
3078
  ]);
3002
- const [selected, toggleSelected] = useOnToggle(isSelected, defaultSelected);
3003
- const [isHovered, toggleHovered] = React3.useState(false);
3004
- const handleMouseLeave = (e) => {
3005
- toggleHovered(false);
3006
- onMouseLeave && onMouseLeave(e);
3007
- };
3008
- const handleMouseEnter = (e) => {
3009
- toggleHovered(true);
3010
- onMouseEnter && onMouseEnter(e);
3011
- };
3012
- const handleClick = (e) => {
3013
- if (disabled) {
3014
- return;
3079
+ const [isHovered, setIsHovered] = React3.useState(false);
3080
+ const handleOnClick = (e) => {
3081
+ e.preventDefault();
3082
+ e.stopPropagation();
3083
+ if (!disabled) {
3084
+ onClick && onClick(e);
3015
3085
  }
3016
- onClick && onClick(e);
3017
- toggleSelected();
3018
3086
  };
3019
- return /* @__PURE__ */ jsxRuntime.jsx(
3020
- Container3,
3021
- __spreadProps(__spreadValues({
3022
- onClick: handleClick,
3023
- onMouseLeave: handleMouseLeave,
3024
- onMouseEnter: handleMouseEnter,
3025
- disabled
3026
- }, rest), {
3027
- "data-shoplflow": "Checkbox",
3028
- children: /* @__PURE__ */ jsxRuntime.jsx(StyledCheckbox, { styleVar, isHovered, isSelected: selected, disabled, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "8", viewBox: "0 0 12 8", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx(
3029
- "path",
3030
- {
3031
- fillRule: "evenodd",
3032
- clipRule: "evenodd",
3033
- d: "M9.78822 0.297596C10.1761 -0.0955083 10.8093 -0.0997053 11.2024 0.288222C11.5653 0.646308 11.5968 1.21334 11.2943 1.60765L11.2118 1.7024L5.31714 7.7024C4.95248 8.07193 4.37282 8.09687 3.97909 7.77976L3.88476 7.69335L0.779404 4.42669C0.396475 4.02871 0.408672 3.39567 0.806647 3.01274C1.17401 2.65926 1.74167 2.64247 2.12801 2.95499L2.2206 3.03998L4.614 5.567L9.78822 0.297596Z",
3034
- fill: "white"
3035
- }
3036
- ) }) })
3037
- })
3038
- );
3039
- };
3040
- exports.Checkbox = Checkbox;
3041
-
3042
- // src/components/ControlButtons/Checkbox/Checkbox.types.ts
3043
- exports.CheckboxStyleVariants = {
3044
- PRIMARY: "PRIMARY",
3045
- LINE: "LINE"
3046
- };
3047
- var getSelectedStyle = (isHovered) => {
3048
- return react$1.css`
3049
- & > svg > circle {
3050
- stroke: ${exports.colorTokens.primary300};
3051
- }
3052
- ${isHovered && react$1.css`
3053
- & > svg > circle {
3054
- stroke: ${exports.colorTokens.primary400};
3055
- }
3056
- `}
3057
- `;
3058
- };
3059
- var StyledRadio = styled6__default.default.div`
3060
- display: flex;
3061
- align-items: center;
3062
- justify-content: center;
3063
- min-width: 16px;
3064
- min-height: 16px;
3065
- width: 16px;
3066
- height: 16px;
3067
- ${({ isHovered }) => react$1.css`
3068
- & > svg > circle {
3069
- stroke: ${exports.colorTokens.neutral200};
3087
+ const handleOnClear = (e) => {
3088
+ e.preventDefault();
3089
+ e.stopPropagation();
3090
+ if (!disabled) {
3091
+ onClear && onClear(e);
3070
3092
  }
3071
- ${isHovered && react$1.css`
3072
- & > svg > circle {
3073
- stroke: ${exports.colorTokens.neutral300};
3074
- }
3075
- `}
3076
- `}
3077
- cursor: pointer;
3078
- ${({ isSelected, isHovered }) => isSelected && getSelectedStyle(isHovered)}
3079
- ${({ disabled }) => getDisabledStyle(disabled)}
3080
- `;
3081
- var Container4 = styled6__default.default.button`
3082
- display: flex;
3083
- align-items: center;
3084
- justify-content: center;
3085
- background: transparent;
3086
- padding: 4px;
3087
- width: fit-content;
3088
- height: fit-content;
3089
- `;
3090
- var Radio = (_a) => {
3091
- var _b = _a, { isSelected, defaultSelected, disabled, onClick, onMouseEnter, onMouseLeave } = _b, rest = __objRest(_b, ["isSelected", "defaultSelected", "disabled", "onClick", "onMouseEnter", "onMouseLeave"]);
3092
- const [selected, toggleSelected] = useOnToggle(isSelected, defaultSelected);
3093
- const [isHovered, toggleHovered] = React3.useState(false);
3094
- const handleMouseLeave = (e) => {
3095
- toggleHovered(false);
3096
- onMouseLeave && onMouseLeave(e);
3097
3093
  };
3098
- const handleMouseEnter = (e) => {
3099
- toggleHovered(true);
3094
+ const handleOnMouseEnter = (e) => {
3095
+ setIsHovered(true);
3100
3096
  onMouseEnter && onMouseEnter(e);
3101
3097
  };
3102
- const handleClick = (e) => {
3103
- if (disabled) {
3104
- return;
3105
- }
3106
- onClick && onClick(e);
3107
- toggleSelected();
3098
+ const handleOnMouseLeave = (e) => {
3099
+ setIsHovered(false);
3100
+ onMouseLeave && onMouseLeave(e);
3108
3101
  };
3109
3102
  return /* @__PURE__ */ jsxRuntime.jsx(
3110
- Container4,
3103
+ InputWrapper,
3111
3104
  __spreadProps(__spreadValues({
3112
- onClick: handleClick,
3113
- onMouseEnter: handleMouseEnter,
3114
- onMouseLeave: handleMouseLeave
3105
+ onMouseEnter: handleOnMouseEnter,
3106
+ onMouseLeave: handleOnMouseLeave,
3107
+ onClick: handleOnClick,
3108
+ isHovered,
3109
+ isFocused: isSelected,
3110
+ disabled,
3111
+ width
3115
3112
  }, rest), {
3116
- "data-shoplflow": "Radio",
3117
- children: /* @__PURE__ */ jsxRuntime.jsx(StyledRadio, { isSelected: selected, isHovered, disabled, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8", cy: "8", r: "5.5", fill: "white", stroke: "#3299FE", strokeWidth: "5" }) }) })
3113
+ "data-shoplflow": "SelectInputButton",
3114
+ children: /* @__PURE__ */ jsxRuntime.jsxs(StyledSelectInputButton, { children: [
3115
+ 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 }),
3116
+ /* @__PURE__ */ jsxRuntime.jsxs(exports.Stack.Horizontal, { align: "center", spacing: "spacing04", children: [
3117
+ value && value.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs(exports.Text, { typography: "body1_400", color: "neutral700", children: [
3118
+ "+",
3119
+ value.length - 1
3120
+ ] }),
3121
+ /* @__PURE__ */ jsxRuntime.jsxs(exports.Stack.Horizontal, { align: "center", children: [
3122
+ 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" }) }),
3123
+ rightSource
3124
+ ] })
3125
+ ] })
3126
+ ] })
3118
3127
  })
3119
3128
  );
3120
3129
  };
3121
- exports.Radio = Radio;
3130
+ exports.SelectInputButton = SelectInputButton;
3122
3131
  /*! Bundled license information:
3123
3132
 
3124
3133
  classnames/index.js: