@shoplflow/base 0.32.18 → 0.32.20

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.js CHANGED
@@ -5,15 +5,15 @@ import { motion, AnimatePresence, LayoutGroup, LazyMotion, domAnimation } from '
5
5
  import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
6
6
  import { createPortal } from 'react-dom';
7
7
  import { css } from '@emotion/react';
8
- import { useMergeRefs, noop, OutSideClick, useSelect, useOutsideClick, useParentElementClick, isNullOrUndefined } from '@shoplflow/utils';
8
+ import { useMergeRefs, noop, useOutsideClick, OutSideClick, useSelect, useParentElementClick, isNullOrUndefined } from '@shoplflow/utils';
9
9
  import Scrollbars from 'react-custom-scrollbars-2';
10
10
  import { FloatingPortal, autoUpdate, offset, autoPlacement } from '@floating-ui/react';
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
14
  import { DownArrowSolidXsmallIcon, DownArrowIcon, FirstPageIcon, LeftArrowIcon, RightArrowIcon, EndPageIcon } from '@shoplflow/shopl-assets';
15
+ import { shift, flip, offset as offset$1 } from '@floating-ui/core';
15
16
  import * as HadaAssets from '@shoplflow/hada-assets';
16
- import { flip, shift, offset as offset$1 } from '@floating-ui/core';
17
17
  import DatePicker2 from 'react-datepicker';
18
18
  import 'react-datepicker/dist/react-datepicker.css';
19
19
  import SimpleBarReact from 'simplebar-react';
@@ -1784,65 +1784,26 @@ var IconButtonStyleVariants = {
1784
1784
  SOLID: "SOLID",
1785
1785
  GHOST: "GHOST"
1786
1786
  };
1787
- var informationStyle = css`
1788
- background: ${colorTokens.neutral100};
1789
- & > span {
1790
- color: ${colorTokens.neutral600};
1791
- }
1792
- & > svg > path {
1793
- fill: ${colorTokens.neutral600};
1794
- }
1795
- `;
1796
- var alertStyle = css`
1797
- background: ${colorTokens.red100};
1798
- & > span {
1799
- align-self: center;
1800
- color: ${colorTokens.red300};
1801
- }
1802
- & > svg > path {
1803
- fill: ${colorTokens.red300};
1804
- }
1805
- `;
1806
- var StyledCallout = styled6.div`
1807
- display: flex;
1808
- justify-content: flex-start;
1809
- align-items: start;
1810
- padding: 6px 8px;
1811
- gap: 4px;
1812
- border-radius: ${borderRadiusTokens.borderRadius08};
1813
- ${({ styleVar }) => styleVar === "INFORMATION" && informationStyle}
1814
- ${({ styleVar }) => styleVar === "ALERT" && alertStyle}
1787
+ var getPopoverContentStyle = () => {
1788
+ return css`
1789
+ min-width: 112px;
1790
+ padding: 4px;
1791
+ box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.12);
1792
+ border-radius: 8px;
1793
+ background-color: ${colorTokens.neutral0};
1794
+ `;
1795
+ };
1796
+
1797
+ // src/components/Buttons/DropdownButton/DropdownButton.styled.ts
1798
+ var StyledPopoverContentWrapper = styled6.div`
1799
+ ${getPopoverContentStyle()}
1815
1800
  `;
1816
- var StyledCalloutIcon = styled6.svg`
1801
+ var StyledArrowIcon = styled6(motion.div)`
1817
1802
  display: flex;
1818
- height: 20px;
1819
- min-height: 20px;
1820
- width: 20px;
1821
- min-width: 20px;
1822
- `;
1823
- styled6.div`
1824
- padding: 2px 0;
1803
+ justify-content: center;
1804
+ align-items: center;
1805
+ flex-shrink: 0;
1825
1806
  `;
1826
- var Callout = (_a) => {
1827
- var _b = _a, { children, styleVar = "INFORMATION" } = _b, rest = __objRest(_b, ["children", "styleVar"]);
1828
- return /* @__PURE__ */ jsx(StyledCallout, __spreadProps(__spreadValues({}, rest), { styleVar, "data-shoplflow": "Callout", children }));
1829
- };
1830
- var CalloutText = (_a) => {
1831
- var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
1832
- return /* @__PURE__ */ jsx(Text_default, __spreadProps(__spreadValues({}, rest), { typography: "paragraph2", children }));
1833
- };
1834
- var CalloutIcon = ({ iconSource }) => {
1835
- return /* @__PURE__ */ jsx(StyledCalloutIcon, { as: iconSource });
1836
- };
1837
- Callout.Text = CalloutText;
1838
- Callout.Icon = CalloutIcon;
1839
- var Callout_default = Callout;
1840
-
1841
- // src/components/Callout/Callout.types.ts
1842
- var CalloutTypes = {
1843
- INFORMATION: "INFORMATION",
1844
- ALERT: "ALERT"
1845
- };
1846
1807
  var StyledPopper = styled6.div`
1847
1808
  width: ${({ width }) => width != null ? width : "fit-content"};
1848
1809
  height: ${({ height }) => height && height};
@@ -1947,180 +1908,410 @@ var PopperPortal = forwardRef(
1947
1908
  Popper.Trigger = PopperTrigger;
1948
1909
  Popper.Portal = PopperPortal;
1949
1910
  var Popper_default = Popper;
1950
- var getDropdownHeightBySizeVar = (size2) => {
1951
- switch (size2) {
1952
- case "M":
1953
- return "40px";
1954
- case "S":
1955
- return "32px";
1956
- default:
1957
- return "40px";
1958
- }
1959
- };
1960
- var getDropdownFontSizeBySizeVar = (size2) => {
1961
- switch (size2) {
1962
- case "M":
1963
- return "body1_400";
1964
- case "S":
1965
- return "body2_400";
1966
- default:
1967
- return "body1_400";
1968
- }
1969
- };
1970
- var getDropdownStyleBySizeVar = (size2) => {
1971
- switch (size2) {
1972
- case "M":
1973
- return css`
1974
- padding: 4px 4px 4px 12px;
1975
- `;
1976
- case "S":
1977
- return css`
1978
- padding: 4px 4px 4px 8px;
1979
- gap: 4px;
1980
- `;
1981
- default:
1982
- return css`
1983
- padding: 4px 4px 4px 12px;
1984
- `;
1911
+ var Container2 = styled6.div`
1912
+ display: flex;
1913
+ align-items: center;
1914
+ justify-content: center;
1915
+ width: 24px;
1916
+ height: 24px;
1917
+ padding: 4px;
1918
+ `;
1919
+ var IconButton2 = styled6.button`
1920
+ display: flex;
1921
+ width: 16px;
1922
+ height: 16px;
1923
+ flex-direction: column;
1924
+ justify-content: center;
1925
+ align-items: center;
1926
+ border-radius: ${borderRadiusTokens.borderRadius04};
1927
+ border: none;
1928
+ background: ${({ color }) => colorTokens[color]};
1929
+ cursor: pointer;
1930
+ transition:
1931
+ transform 0.1s ease-out,
1932
+ background 0.1s ease;
1933
+
1934
+ &:hover {
1935
+ background: ${({ color }) => colorTokens[getNextColor(color, 1)]};
1985
1936
  }
1986
- };
1987
- var getDropdownIconSizeBySizeVar = (size2) => {
1988
- switch (size2) {
1989
- case "S":
1937
+ `;
1938
+ var MUNUS_BUTTON_SYMBOL_KEY = Symbol("SHOPLFLOW_MUNUS_BUTTON");
1939
+ var MinusButton = forwardRef((_a, ref) => {
1940
+ var _b = _a, { onClick, color = "neutral300" } = _b, rest = __objRest(_b, ["onClick", "color"]);
1941
+ return /* @__PURE__ */ jsx(Container2, { "data-shoplflow": "minusButton", children: /* @__PURE__ */ jsx(IconButton2, __spreadProps(__spreadValues({ color, onClick, ref }, rest), { children: /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
1942
+ /* @__PURE__ */ jsx(
1943
+ "path",
1944
+ {
1945
+ 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",
1946
+ fill: "none"
1947
+ }
1948
+ ),
1949
+ /* @__PURE__ */ jsx(
1950
+ "path",
1951
+ {
1952
+ fillRule: "evenodd",
1953
+ clipRule: "evenodd",
1954
+ 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",
1955
+ fill: "white"
1956
+ }
1957
+ )
1958
+ ] }) })) });
1959
+ });
1960
+ MinusButton[MUNUS_BUTTON_SYMBOL_KEY] = true;
1961
+ var MinusButton_default = MinusButton;
1962
+ var getStylesByStyleVariant = (styleVariant, isSelected, isHovered) => {
1963
+ switch (styleVariant) {
1964
+ case "PRIMARY":
1965
+ if (isSelected) {
1966
+ return css`
1967
+ background: ${colorTokens.primary300};
1968
+ border: 1.5px solid ${colorTokens.primary300};
1969
+ & > svg > path {
1970
+ fill: ${colorTokens.neutral0};
1971
+ }
1972
+ ${isHovered && css`
1973
+ border: 1.5px solid ${colorTokens.primary400};
1974
+ background: ${colorTokens.primary400};
1975
+ `}
1976
+ `;
1977
+ }
1990
1978
  return css`
1991
- height: 24px;
1992
- width: 24px;
1993
- min-width: 24px;
1994
- min-height: 24px;
1979
+ background: ${colorTokens.neutral200};
1980
+ border: 1.5px solid ${colorTokens.neutral200};
1981
+ border-radius: 4px;
1982
+ ${isHovered && css`
1983
+ border: 1.5px solid ${colorTokens.neutral300};
1984
+ background: ${colorTokens.neutral300};
1985
+ `}
1986
+
1987
+ & > svg > path {
1988
+ fill: ${colorTokens.neutral0};
1989
+ }
1995
1990
  `;
1996
- case "M":
1991
+ case "LINE":
1992
+ if (isSelected) {
1993
+ return css`
1994
+ border: 1.5px solid ${colorTokens.primary300};
1995
+ background: transparent;
1996
+ border-radius: 4px;
1997
+ & > svg > path {
1998
+ fill: ${colorTokens.primary300};
1999
+ }
2000
+ ${isHovered && css`
2001
+ border: 1.5px solid ${colorTokens.primary400};
2002
+ & > svg > path {
2003
+ fill: ${colorTokens.primary400};
2004
+ }
2005
+ `}
2006
+ `;
2007
+ }
1997
2008
  return css`
1998
- height: 32px;
1999
- width: 32px;
2000
- min-width: 32px;
2001
- min-height: 32px;
2009
+ background: transparent;
2010
+ border: 1.5px solid ${colorTokens.neutral200};
2011
+ border-radius: 4px;
2012
+ & > svg > path {
2013
+ fill: ${colorTokens.neutral200};
2014
+ }
2015
+ ${isHovered && css`
2016
+ border: 1.5px solid ${colorTokens.neutral300};
2017
+ & > svg > path {
2018
+ fill: ${colorTokens.neutral300};
2019
+ }
2020
+ `}
2002
2021
  `;
2003
2022
  default:
2004
- return css`
2005
- height: 32px;
2006
- width: 32px;
2007
- min-width: 32px;
2008
- min-height: 32px;
2009
- `;
2023
+ return "";
2010
2024
  }
2011
2025
  };
2012
- var StyledDropdown = styled6.div`
2013
- width: ${({ width }) => width};
2026
+ var StyledCheckHiddenInput = styled6.input`
2027
+ position: absolute;
2028
+ width: 0;
2029
+ height: 0;
2030
+ opacity: 0;
2031
+ visibility: hidden;
2014
2032
  `;
2015
- var StyledDropdownContent = styled6.div`
2033
+ var StyledCheckbox = styled6.label`
2016
2034
  display: flex;
2017
- flex-direction: column;
2018
- background: ${colorTokens.neutral0};
2019
- width: ${({ width }) => width != null ? width : "240px"};
2020
- padding: 4px;
2021
- border-radius: 6px;
2022
- box-shadow: ${boxShadowTokens.dropShadow};
2035
+ align-items: center;
2036
+ justify-content: center;
2037
+ min-width: 16px;
2038
+ min-height: 16px;
2039
+ width: 16px;
2040
+ height: 16px;
2041
+ background: ${colorTokens.neutral200};
2042
+ border-radius: 4px;
2043
+ box-sizing: border-box;
2044
+ cursor: pointer;
2045
+ ${({ styleVar, isSelected, isHovered }) => getStylesByStyleVariant(styleVar, isSelected, isHovered)};
2046
+ ${({ disabled }) => getDisabledStyle(disabled)}
2023
2047
  `;
2024
- var StyledDropdownButton = styled6.button`
2048
+ var Container3 = styled6.button`
2025
2049
  display: flex;
2026
- flex-direction: row;
2027
2050
  align-items: center;
2028
- justify-content: space-between;
2029
- width: 100%;
2030
- height: 100%;
2031
- gap: 8px;
2032
- cursor: pointer;
2033
- background-color: ${colorTokens.neutral0};
2034
- ${({ sizeVar }) => sizeVar && getDropdownStyleBySizeVar(sizeVar)};
2035
- ${({ disabled }) => disabled && css`
2036
- background-color: ${colorTokens.neutral100};
2037
- cursor: not-allowed;
2051
+ justify-content: center;
2052
+ padding: 4px;
2053
+ width: fit-content;
2054
+ height: fit-content;
2055
+ background-color: transparent;
2056
+ `;
2057
+ var CHECKBOX_SYMBOL_KEY = Symbol("SHOPLFLOW_CHECKBOX");
2058
+ var Checkbox = forwardRef(
2059
+ (_a, ref) => {
2060
+ var _b = _a, { defaultSelected, isSelected, disabled, onMouseEnter, onClick, onMouseLeave, styleVar = "PRIMARY", id } = _b, rest = __objRest(_b, ["defaultSelected", "isSelected", "disabled", "onMouseEnter", "onClick", "onMouseLeave", "styleVar", "id"]);
2061
+ const [selected, toggleSelected] = useOnToggle(isSelected, defaultSelected);
2062
+ const [isHovered, toggleHovered] = useState(false);
2063
+ const handleMouseLeave = (e) => {
2064
+ toggleHovered(false);
2065
+ onMouseLeave && onMouseLeave(e);
2066
+ };
2067
+ const handleMouseEnter = (e) => {
2068
+ toggleHovered(true);
2069
+ onMouseEnter && onMouseEnter(e);
2070
+ };
2071
+ const handleClick = (e) => {
2072
+ if (disabled) {
2073
+ return;
2074
+ }
2075
+ onClick && onClick(e);
2076
+ toggleSelected();
2077
+ };
2078
+ return /* @__PURE__ */ jsxs(
2079
+ Container3,
2080
+ {
2081
+ onClick: handleClick,
2082
+ onMouseLeave: handleMouseLeave,
2083
+ onMouseEnter: handleMouseEnter,
2084
+ disabled,
2085
+ type: "button",
2086
+ "data-shoplflow": "Checkbox",
2087
+ children: [
2088
+ /* @__PURE__ */ jsx(StyledCheckHiddenInput, __spreadProps(__spreadValues({ type: "checkbox", disabled, id }, rest), { ref })),
2089
+ /* @__PURE__ */ jsx(
2090
+ StyledCheckbox,
2091
+ {
2092
+ styleVar,
2093
+ htmlFor: id,
2094
+ isHovered,
2095
+ isSelected: selected,
2096
+ disabled,
2097
+ children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "8", viewBox: "0 0 12 8", fill: "none", children: /* @__PURE__ */ jsx(
2098
+ "path",
2099
+ {
2100
+ fillRule: "evenodd",
2101
+ clipRule: "evenodd",
2102
+ 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",
2103
+ fill: "white"
2104
+ }
2105
+ ) })
2106
+ }
2107
+ )
2108
+ ]
2109
+ }
2110
+ );
2111
+ }
2112
+ );
2113
+ Checkbox[CHECKBOX_SYMBOL_KEY] = true;
2114
+ var Checkbox_default = Checkbox;
2115
+
2116
+ // src/components/ControlButtons/Checkbox/Checkbox.types.ts
2117
+ var CheckboxStyleVariants = {
2118
+ PRIMARY: "PRIMARY",
2119
+ LINE: "LINE"
2120
+ };
2121
+ var getSelectedStyle = (isHovered) => {
2122
+ return css`
2123
+ & > svg > circle {
2124
+ stroke: ${colorTokens.primary300};
2125
+ }
2126
+ ${isHovered && css`
2127
+ & > svg > circle {
2128
+ stroke: ${colorTokens.primary400};
2129
+ }
2038
2130
  `}
2131
+ `;
2132
+ };
2133
+ var StyledRadio = styled6.div`
2134
+ display: flex;
2135
+ align-items: center;
2136
+ justify-content: center;
2137
+ min-width: 16px;
2138
+ min-height: 16px;
2139
+ width: 16px;
2140
+ height: 16px;
2141
+ ${({ isHovered }) => css`
2142
+ & > svg > circle {
2143
+ stroke: ${colorTokens.neutral200};
2144
+ }
2145
+ ${isHovered && css`
2146
+ & > svg > circle {
2147
+ stroke: ${colorTokens.neutral300};
2148
+ }
2149
+ `}
2150
+ `}
2151
+ cursor: pointer;
2152
+ ${({ isSelected, isHovered }) => isSelected && getSelectedStyle(isHovered)}
2153
+ ${({ disabled }) => getDisabledStyle(disabled)}
2039
2154
  `;
2040
- var DropdownButtonIcon = styled6(motion.div)`
2155
+ var Container4 = styled6.button`
2041
2156
  display: flex;
2042
2157
  align-items: center;
2043
2158
  justify-content: center;
2044
-
2045
- ${({ sizeVar }) => sizeVar && getDropdownIconSizeBySizeVar(sizeVar)};
2159
+ background: transparent;
2160
+ padding: 4px;
2161
+ width: fit-content;
2162
+ height: fit-content;
2046
2163
  `;
2047
- var DropdownContext = createContext(null);
2048
- var useDropdown = () => {
2049
- const context = useContext(DropdownContext);
2050
- if (context === null) {
2051
- throw new Error("useDropdown must be used within a DropdownProvider");
2164
+ var RADIO_SYMBOL_KEY = Symbol("SHOPLFLOW_RADIO");
2165
+ var Radio = (_a) => {
2166
+ var _b = _a, { isSelected, defaultSelected, disabled, onClick, onMouseEnter, onMouseLeave } = _b, rest = __objRest(_b, ["isSelected", "defaultSelected", "disabled", "onClick", "onMouseEnter", "onMouseLeave"]);
2167
+ const [selected, toggleSelected] = useOnToggle(isSelected, defaultSelected);
2168
+ const [isHovered, toggleHovered] = useState(false);
2169
+ const handleMouseLeave = (e) => {
2170
+ toggleHovered(false);
2171
+ onMouseLeave && onMouseLeave(e);
2172
+ };
2173
+ const handleMouseEnter = (e) => {
2174
+ toggleHovered(true);
2175
+ onMouseEnter && onMouseEnter(e);
2176
+ };
2177
+ const handleClick = (e) => {
2178
+ if (disabled) {
2179
+ return;
2180
+ }
2181
+ onClick && onClick(e);
2182
+ toggleSelected();
2183
+ };
2184
+ return /* @__PURE__ */ jsx(
2185
+ Container4,
2186
+ __spreadProps(__spreadValues({
2187
+ onClick: handleClick,
2188
+ onMouseEnter: handleMouseEnter,
2189
+ onMouseLeave: handleMouseLeave
2190
+ }, rest), {
2191
+ "data-shoplflow": "Radio",
2192
+ children: /* @__PURE__ */ jsx(StyledRadio, { isSelected: selected, isHovered, disabled, children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "5.5", fill: "white", stroke: "#3299FE", strokeWidth: "5" }) }) })
2193
+ })
2194
+ );
2195
+ };
2196
+ Radio[RADIO_SYMBOL_KEY] = true;
2197
+ var Radio_default = Radio;
2198
+
2199
+ // src/components/Menu/Menu.styled.ts
2200
+ var getStylesBySizeVar = (sizeVar) => {
2201
+ switch (sizeVar) {
2202
+ case "XS":
2203
+ return css`
2204
+ min-height: 28px;
2205
+ `;
2206
+ case "S":
2207
+ return css`
2208
+ min-height: 36px;
2209
+ `;
2210
+ case "M":
2211
+ return css`
2212
+ height: 48px;
2213
+ `;
2214
+ default:
2215
+ return css`
2216
+ height: 48px;
2217
+ `;
2052
2218
  }
2053
- return context;
2054
2219
  };
2055
- var getBorderColorByStatus = ({ isFocused, isError, isHovered, disabled }) => {
2056
- if (!disabled) {
2057
- if (isError) {
2058
- return colorTokens.red300;
2059
- }
2060
- if (isFocused) {
2061
- return colorTokens.primary300;
2062
- }
2063
- if (isHovered) {
2064
- return colorTokens.neutral700;
2065
- }
2220
+ var getFontStylesBySizeVar = (sizeVar) => {
2221
+ switch (sizeVar) {
2222
+ case "XS":
2223
+ return "body2_400";
2224
+ case "S":
2225
+ return "body1_400";
2226
+ case "M":
2227
+ return "body1_400";
2228
+ default:
2229
+ return "body1_400";
2066
2230
  }
2067
- return colorTokens.neutral300;
2068
2231
  };
2069
- var getStyleByType = ({
2070
- type,
2071
- height,
2072
- minHeight,
2073
- maxHeight,
2074
- width,
2075
- minWidth,
2076
- maxWidth,
2077
- borderRadius,
2078
- customNumberInputHeight
2079
- }) => {
2080
- if (type === "number") {
2081
- return css`
2082
- width: ${width || "64px"};
2083
- height: ${customNumberInputHeight || "32px"};
2084
- border-radius: ${borderRadius ? borderRadiusTokens[borderRadius] : "6px"};
2085
- `;
2232
+ var StyledMenu = styled6.li`
2233
+ display: flex;
2234
+ width: 100%;
2235
+ flex-direction: row;
2236
+ align-items: center;
2237
+ padding: 6px;
2238
+ gap: 4px;
2239
+ border-radius: 4px;
2240
+ cursor: pointer;
2241
+ background: transparent;
2242
+ ${({ sizeVar }) => getStylesBySizeVar(sizeVar)};
2243
+ &:hover {
2244
+ background: ${colorTokens.neutral400_5};
2245
+ }
2246
+ ${({ disabled }) => disabled && getDisabledStyle(disabled)}
2247
+ ${({ isSelected, leftSource }) => isSelected === true && (!leftSource || leftSource && !leftSource.type[RADIO_SYMBOL_KEY] && !leftSource.type[CHECKBOX_SYMBOL_KEY] && !leftSource.type[MUNUS_BUTTON_SYMBOL_KEY]) && css`
2248
+ background: ${colorTokens.neutral200};
2249
+ &:hover {
2250
+ background: ${colorTokens.neutral200};
2251
+ }
2252
+ `}
2253
+ `;
2254
+ var Menu = (_a) => {
2255
+ var _b = _a, {
2256
+ leftSource,
2257
+ rightSource,
2258
+ children,
2259
+ isSelected,
2260
+ defaultSelected = false,
2261
+ onClick,
2262
+ sizeVar = "XS",
2263
+ disabled = false
2264
+ } = _b, rest = __objRest(_b, [
2265
+ "leftSource",
2266
+ "rightSource",
2267
+ "children",
2268
+ "isSelected",
2269
+ "defaultSelected",
2270
+ "onClick",
2271
+ "sizeVar",
2272
+ "disabled"
2273
+ ]);
2274
+ const [selected, handleToggle] = useOnToggle(isSelected, defaultSelected);
2275
+ const LeftSourceClone = leftSource ? React3__default.cloneElement(leftSource, __spreadProps(__spreadValues({}, rest), {
2276
+ isSelected
2277
+ })) : leftSource;
2278
+ const handleOnClick = (e) => {
2279
+ !disabled && handleToggle();
2280
+ !disabled && onClick && onClick(e);
2281
+ };
2282
+ return /* @__PURE__ */ jsxs(
2283
+ StyledMenu,
2284
+ __spreadProps(__spreadValues({
2285
+ sizeVar,
2286
+ isSelected: selected,
2287
+ leftSource,
2288
+ onClick: handleOnClick
2289
+ }, rest), {
2290
+ "data-shoplflow": "Menu",
2291
+ children: [
2292
+ leftSource && LeftSourceClone,
2293
+ /* @__PURE__ */ jsx(Stack_default.Horizontal, { width: "100%", height: "100%", align: "center", className: getFontStylesBySizeVar(sizeVar), children }),
2294
+ rightSource && rightSource
2295
+ ]
2296
+ })
2297
+ );
2298
+ };
2299
+ var Menu_default = Menu;
2300
+
2301
+ // src/components/Menu/Menu.types.ts
2302
+ var MenuSizeVariants = {
2303
+ XS: "XS",
2304
+ S: "S",
2305
+ M: "M"
2306
+ };
2307
+ var DropdownButtonContext = createContext(null);
2308
+ var useDropdownButtonContext = () => {
2309
+ const context = useContext(DropdownButtonContext);
2310
+ if (!context) {
2311
+ throw new Error("DropdownButtonContext must be used within a DropdownButton component");
2086
2312
  }
2087
- return css`
2088
- width: ${width || "100%"};
2089
- min-width: ${minWidth || "initial"};
2090
- max-width: ${maxWidth || "initial"};
2091
- height: ${height || "initial"};
2092
- min-height: ${minHeight || "initial"};
2093
- max-height: ${maxHeight || "initial"};
2094
- border-radius: ${borderRadius ? borderRadiusTokens[borderRadius] : "6px"};
2095
- `;
2313
+ return context;
2096
2314
  };
2097
- var InputWrapper = styled6.label`
2098
- position: relative;
2099
- display: flex;
2100
- align-items: center;
2101
- border-radius: 6px;
2102
- flex-direction: ${({ direction }) => direction || "row"};
2103
- ${({ type, height, minHeight, maxHeight, width, maxWidth, minWidth, borderRadius, customNumberInputHeight }) => getStyleByType({
2104
- customNumberInputHeight,
2105
- type,
2106
- height,
2107
- minHeight,
2108
- maxHeight,
2109
- width,
2110
- maxWidth,
2111
- minWidth,
2112
- borderRadius
2113
- })};
2114
- justify-content: space-between;
2115
- gap: ${({ gap }) => gap || "8px"};
2116
- border: 1px solid ${(props) => getBorderColorByStatus(props)};
2117
- background-color: ${colorTokens.neutral0};
2118
- overflow: hidden;
2119
- ${({ disabled }) => disabled && css`
2120
- background-color: ${colorTokens.neutral100};
2121
- cursor: not-allowed;
2122
- `};
2123
- `;
2124
2315
 
2125
2316
  // src/components/Icon/Icon.types.ts
2126
2317
  var IconSizeVariants = {
@@ -2162,532 +2353,677 @@ var Icon = forwardRef((_a, ref) => {
2162
2353
  return /* @__PURE__ */ jsx(StyledIcon, __spreadProps(__spreadValues({ as: iconSource, ref }, rest), { "data-shoplflow": "Icon" }));
2163
2354
  });
2164
2355
  var Icon_default = Icon;
2165
- var DropdownButton = forwardRef(
2166
- (_a, ref) => {
2167
- var _b = _a, { width = "100%", onClick, sizeVar = "M", isError, placeholder, value, disabled, leftSource } = _b, rest = __objRest(_b, ["width", "onClick", "sizeVar", "isError", "placeholder", "value", "disabled", "leftSource"]);
2168
- const { isOpen, setIsOpen } = useDropdown();
2169
- const [isHovered, setIsHovered] = useState(false);
2170
- const handleOnClick = (e) => {
2171
- if (!disabled) {
2172
- onClick && onClick(e);
2173
- setIsOpen(!isOpen);
2174
- }
2175
- };
2176
- const handleOnMouseEnter = () => {
2177
- setIsHovered(true);
2178
- };
2179
- const handleOnMouseLeave = () => {
2180
- setIsHovered(false);
2181
- };
2182
- const getTextColor = ({ value: value2, disabled: disabled2 }) => {
2183
- if (disabled2) {
2184
- return "neutral350";
2185
- }
2186
- if (!value2) {
2187
- return "neutral400";
2356
+ var DropdownButtonMenu = (_a) => {
2357
+ var _b = _a, { onClick, children } = _b, rest = __objRest(_b, ["onClick", "children"]);
2358
+ const { setIsOpen } = useDropdownButtonContext();
2359
+ return /* @__PURE__ */ jsx(
2360
+ Menu_default,
2361
+ __spreadProps(__spreadValues({
2362
+ onClick: (event) => {
2363
+ event.stopPropagation();
2364
+ event.preventDefault();
2365
+ onClick == null ? void 0 : onClick(event);
2366
+ setIsOpen(false);
2188
2367
  }
2189
- return "neutral700";
2190
- };
2191
- return /* @__PURE__ */ jsx(
2192
- InputWrapper,
2193
- {
2194
- onMouseEnter: handleOnMouseEnter,
2195
- onMouseLeave: handleOnMouseLeave,
2196
- isFocused: isOpen,
2197
- isHovered,
2368
+ }, rest), {
2369
+ children
2370
+ })
2371
+ );
2372
+ };
2373
+ var DropdownButton = (_a) => {
2374
+ var _b = _a, {
2375
+ text,
2376
+ sizeVar,
2377
+ className,
2378
+ disabled,
2379
+ children,
2380
+ placement = "bottom-end",
2381
+ styleVar = "PRIMARY",
2382
+ floatingZIndex
2383
+ } = _b, rest = __objRest(_b, [
2384
+ "text",
2385
+ "sizeVar",
2386
+ "className",
2387
+ "disabled",
2388
+ "children",
2389
+ "placement",
2390
+ "styleVar",
2391
+ "floatingZIndex"
2392
+ ]);
2393
+ const selector = useRef(`shoplflow-${crypto.randomUUID()}-dropdown-button`).current;
2394
+ const [isOpen, setIsOpen] = useOutsideClick({
2395
+ selector: `.${selector}`,
2396
+ useOutsideScroll: true
2397
+ });
2398
+ let _className = `${selector}`;
2399
+ if (className) {
2400
+ _className += ` ${className}`;
2401
+ }
2402
+ let _styleVar = styleVar;
2403
+ let color = void 0;
2404
+ if (styleVar === "PRIMARY") {
2405
+ _styleVar = "SOLID";
2406
+ color = "coolgray50";
2407
+ }
2408
+ return /* @__PURE__ */ jsx(DropdownButtonContext.Provider, { value: { isOpen, setIsOpen }, "data-shoplflow": "DropdownButton", children: /* @__PURE__ */ jsxs(Popper_default, { placement, offset: 4, middlewares: [shift({ crossAxis: true, padding: 4 })], children: [
2409
+ /* @__PURE__ */ jsx(Popper_default.Trigger, { isOpen, className: _className, children: /* @__PURE__ */ jsx(
2410
+ Button_default,
2411
+ __spreadProps(__spreadValues({
2412
+ className: _className,
2413
+ sizeVar,
2414
+ styleVar: _styleVar,
2198
2415
  disabled,
2199
- width,
2200
- isError,
2201
- height: getDropdownHeightBySizeVar(sizeVar),
2202
- children: /* @__PURE__ */ jsxs(StyledDropdownButton, __spreadProps(__spreadValues({ ref, onClick: handleOnClick, disabled }, rest), { sizeVar, children: [
2203
- leftSource && leftSource,
2204
- value || /* @__PURE__ */ jsx(
2205
- Text_default,
2206
- {
2207
- typography: getDropdownFontSizeBySizeVar(sizeVar),
2208
- color: getTextColor({ value, disabled }),
2209
- textOverflow: "ellipsis",
2210
- lineClamp: 1,
2211
- children: placeholder
2212
- }
2213
- ),
2416
+ color,
2417
+ rightSource: /* @__PURE__ */ jsx(
2418
+ StyledArrowIcon,
2419
+ {
2420
+ animate: {
2421
+ rotate: isOpen ? 180 : 0
2422
+ },
2423
+ transition: {
2424
+ duration: 0.2
2425
+ },
2426
+ children: /* @__PURE__ */ jsx(
2427
+ Icon_default,
2428
+ {
2429
+ iconSource: DownArrowSolidXsmallIcon,
2430
+ color: styleVar === "PRIMARY" ? "coolgray300" : "neutral400",
2431
+ sizeVar: "XS"
2432
+ }
2433
+ )
2434
+ }
2435
+ ),
2436
+ onClick: () => {
2437
+ if (disabled) {
2438
+ return;
2439
+ }
2440
+ setIsOpen((prev) => !prev);
2441
+ }
2442
+ }, rest), {
2443
+ children: /* @__PURE__ */ jsx(Text_default, { typography: "body2_400", color: "neutral700", children: text })
2444
+ })
2445
+ ) }),
2446
+ /* @__PURE__ */ jsx(Popper_default.Portal, { zIndex: floatingZIndex, children: /* @__PURE__ */ jsx(StyledPopoverContentWrapper, { className: _className, children }) })
2447
+ ] }) });
2448
+ };
2449
+ DropdownButton.Menu = DropdownButtonMenu;
2450
+ var DropdownButton_default = DropdownButton;
2451
+
2452
+ // src/components/Buttons/DropdownButton/DropdownButton.types.ts
2453
+ var DropdownButtonSizeVariants = {
2454
+ S: "S",
2455
+ M: "M"
2456
+ };
2457
+ var DropdownButtonStyleVariants = {
2458
+ PRIMARY: "PRIMARY",
2459
+ SECONDARY: "SECONDARY"
2460
+ };
2461
+ var getStyleByStyleVar3 = (styleVar, color, disabled) => {
2462
+ switch (styleVar) {
2463
+ case "PRIMARY":
2464
+ return css`
2465
+ border: 1px solid ${colorTokens.primary400};
2466
+ background-color: ${colorTokens.primary300};
2467
+ :hover {
2468
+ background-color: ${!disabled && colorTokens.primary400};
2469
+ }
2470
+ `;
2471
+ case "SECONDARY":
2472
+ return css`
2473
+ border: 1px solid ${colorTokens.neutral350};
2474
+ background-color: ${colorTokens.neutral0};
2475
+ :hover {
2476
+ background-color: ${!disabled && colorTokens.neutral100};
2477
+ }
2478
+ `;
2479
+ default:
2480
+ return css`
2481
+ border: 1px solid ${colorTokens.primary400};
2482
+ background-color: ${colorTokens.primary300};
2483
+ `;
2484
+ }
2485
+ };
2486
+ var getStyleBySizeVar3 = (sizeVar) => {
2487
+ switch (sizeVar) {
2488
+ case "M":
2489
+ return css`
2490
+ min-width: 72px;
2491
+ min-height: 40px;
2492
+ `;
2493
+ case "S":
2494
+ return css`
2495
+ min-width: 54px;
2496
+ min-height: 32px;
2497
+ `;
2498
+ default:
2499
+ return css`
2500
+ min-width: 72px;
2501
+ min-height: 40px;
2502
+ `;
2503
+ }
2504
+ };
2505
+ var StyledPopoverContentWrapper2 = styled6.div`
2506
+ ${getPopoverContentStyle()}
2507
+ `;
2508
+ var StyledArrowIcon2 = styled6(motion.div)`
2509
+ display: flex;
2510
+ justify-content: center;
2511
+ align-items: center;
2512
+ flex-shrink: 0;
2513
+ `;
2514
+ var SplitButtonDivider = styled6.div`
2515
+ height: ${({ sizeVar }) => sizeVar === "M" ? "38px" : "30px"};
2516
+ width: 1px;
2517
+ background-color: ${({ styleVar }) => styleVar === "PRIMARY" ? colorTokens.shopl400 : colorTokens.neutral350};
2518
+ `;
2519
+ var StyledSplitButton = styled6.button`
2520
+ display: flex;
2521
+ align-items: center;
2522
+ justify-content: center;
2523
+ height: fit-content;
2524
+ width: fit-content;
2525
+ gap: 8px;
2526
+ padding: 0 12px;
2527
+ border-radius: 6px;
2528
+ cursor: pointer;
2529
+ ${({ styleVar, color, disabled }) => getStyleByStyleVar3(styleVar, color, disabled)};
2530
+ ${({ sizeVar }) => getStyleBySizeVar3(sizeVar)};
2531
+ ${({ disabled }) => getDisabledStyle(disabled)}
2532
+ `;
2533
+ var SplitButtonContext = createContext(null);
2534
+ var useSplitButtonContext = () => {
2535
+ const context = useContext(SplitButtonContext);
2536
+ if (!context) {
2537
+ throw new Error("SplitButtonContext must be used within a SplitButton component");
2538
+ }
2539
+ return context;
2540
+ };
2541
+ var SplitButtonMenu = (_a) => {
2542
+ var _b = _a, { onClick, children } = _b, rest = __objRest(_b, ["onClick", "children"]);
2543
+ const { setIsOpen } = useSplitButtonContext();
2544
+ return /* @__PURE__ */ jsx(
2545
+ Menu_default,
2546
+ __spreadProps(__spreadValues({
2547
+ onClick: (event) => {
2548
+ event.stopPropagation();
2549
+ event.preventDefault();
2550
+ onClick == null ? void 0 : onClick(event);
2551
+ setIsOpen(false);
2552
+ }
2553
+ }, rest), {
2554
+ children
2555
+ })
2556
+ );
2557
+ };
2558
+ var SplitButton = (_a) => {
2559
+ var _b = _a, {
2560
+ children,
2561
+ color,
2562
+ onClick,
2563
+ disabled,
2564
+ placement = "bottom-start",
2565
+ floatingZIndex,
2566
+ leftSource,
2567
+ rightSource,
2568
+ styleVar = "PRIMARY",
2569
+ sizeVar = "M",
2570
+ lineClamp = 1,
2571
+ text
2572
+ } = _b, rest = __objRest(_b, [
2573
+ "children",
2574
+ "color",
2575
+ "onClick",
2576
+ "disabled",
2577
+ "placement",
2578
+ "floatingZIndex",
2579
+ "leftSource",
2580
+ "rightSource",
2581
+ "styleVar",
2582
+ "sizeVar",
2583
+ "lineClamp",
2584
+ "text"
2585
+ ]);
2586
+ const selector = useRef(`shoplflow-${crypto.randomUUID()}-split-button`).current;
2587
+ const [isOpen, setIsOpen] = useOutsideClick({
2588
+ selector: `.${selector}`,
2589
+ useOutsideScroll: true
2590
+ });
2591
+ return /* @__PURE__ */ jsx(SplitButtonContext.Provider, { value: { isOpen, setIsOpen }, children: /* @__PURE__ */ jsxs(Popper_default, { placement, offset: 4, middlewares: [shift({ crossAxis: true, padding: 4 })], children: [
2592
+ /* @__PURE__ */ jsx(Popper_default.Trigger, { isOpen, className: selector, children: /* @__PURE__ */ jsxs(
2593
+ StyledSplitButton,
2594
+ __spreadProps(__spreadValues({
2595
+ "data-shoplflow": "SplitButton",
2596
+ color,
2597
+ styleVar,
2598
+ sizeVar,
2599
+ disabled
2600
+ }, rest), {
2601
+ onClick: (event) => {
2602
+ event.stopPropagation();
2603
+ event.preventDefault();
2604
+ if (disabled) {
2605
+ return;
2606
+ }
2607
+ onClick == null ? void 0 : onClick(event);
2608
+ setIsOpen((prev) => !prev);
2609
+ },
2610
+ children: [
2611
+ /* @__PURE__ */ jsxs(Stack_default.Horizontal, { spacing: "spacing04", align: "center", children: [
2612
+ leftSource,
2613
+ /* @__PURE__ */ jsx(
2614
+ Text_default,
2615
+ {
2616
+ lineClamp,
2617
+ whiteSpace: "nowrap",
2618
+ wordBreak: "keep-all",
2619
+ color: styleVar === "PRIMARY" ? "neutral0" : "neutral700",
2620
+ typography: sizeVar === "M" ? "body1_400" : "body2_400",
2621
+ children: text
2622
+ }
2623
+ ),
2624
+ rightSource
2625
+ ] }),
2626
+ /* @__PURE__ */ jsx(SplitButtonDivider, { sizeVar, styleVar }),
2214
2627
  /* @__PURE__ */ jsx(
2215
- DropdownButtonIcon,
2628
+ StyledArrowIcon2,
2216
2629
  {
2217
- sizeVar,
2218
2630
  animate: {
2219
2631
  rotate: isOpen ? 180 : 0
2220
2632
  },
2221
2633
  transition: {
2222
2634
  duration: 0.2
2223
2635
  },
2224
- children: /* @__PURE__ */ jsx(Icon_default, { iconSource: DownArrowSolidXsmallIcon, color: "neutral400", sizeVar: "XS" })
2636
+ children: /* @__PURE__ */ jsx(
2637
+ Icon_default,
2638
+ {
2639
+ iconSource: DownArrowSolidXsmallIcon,
2640
+ color: styleVar === "PRIMARY" ? "neutral0" : "neutral600",
2641
+ sizeVar: "XS"
2642
+ }
2643
+ )
2225
2644
  }
2226
2645
  )
2227
- ] }))
2228
- }
2229
- );
2230
- }
2231
- );
2232
- var DropdownContent = (_a) => {
2233
- var _b = _a, { children, width: initialWidth, type, onClick } = _b, rest = __objRest(_b, ["children", "width", "type", "onClick"]);
2234
- const { width, setIsOpen, option } = useDropdown();
2235
- const isFillType = type === "FILL";
2236
- const contentWidth = isFillType ? `${width}px` : initialWidth;
2237
- const returnCallbackByOption = () => {
2238
- if (option === "OUTSIDE_CLICK") {
2239
- return () => setIsOpen(false);
2240
- }
2241
- if (option === "CLICK") {
2242
- return () => setIsOpen(false);
2243
- }
2244
- return noop;
2245
- };
2246
- const handleClick = (e) => {
2247
- onClick && onClick(e);
2248
- if (option === "CLICK") {
2249
- setIsOpen(false);
2250
- }
2251
- };
2252
- return /* @__PURE__ */ jsx(OutSideClick, { outsideClick: returnCallbackByOption(), children: /* @__PURE__ */ jsx(StyledDropdownContent, __spreadProps(__spreadValues({ width: contentWidth, onClick: handleClick }, rest), { children })) });
2646
+ ]
2647
+ })
2648
+ ) }),
2649
+ /* @__PURE__ */ jsx(Popper_default.Portal, { zIndex: floatingZIndex, children: /* @__PURE__ */ jsx(StyledPopoverContentWrapper2, { children }) })
2650
+ ] }) });
2253
2651
  };
2254
- var Dropdown = ({
2255
- isOpen: initialIsOpen = false,
2256
- trigger,
2257
- popper,
2258
- option = "CLICK",
2259
- width = "100%"
2260
- }) => {
2261
- const [triggerRef, setTriggerRef] = useState(null);
2262
- const [size2, setSize] = useState({ width: 0, height: 0 });
2263
- const [isOpen, setIsOpen] = useState(false);
2264
- useEffect(() => {
2265
- if (triggerRef) {
2266
- setSize({
2267
- width: triggerRef.offsetWidth,
2268
- height: triggerRef.offsetHeight
2269
- });
2270
- }
2271
- }, [triggerRef]);
2272
- useEffect(() => {
2273
- if (initialIsOpen === void 0) {
2274
- return;
2275
- }
2276
- setIsOpen(initialIsOpen);
2277
- }, [initialIsOpen]);
2278
- return /* @__PURE__ */ jsx(StyledDropdown, { "data-shoplflow": "Dropdown", width, children: /* @__PURE__ */ jsx(DropdownContext.Provider, { value: __spreadProps(__spreadValues({}, size2), { isOpen, setIsOpen, option }), children: /* @__PURE__ */ jsxs(
2279
- Popper_default,
2280
- {
2281
- offset: 4,
2282
- autoPlacement: {
2283
- allowedPlacements: ["bottom-start", "top-start"]
2284
- },
2285
- children: [
2286
- /* @__PURE__ */ jsx(Popper_default.Trigger, { ref: setTriggerRef, isOpen, width, children: trigger }),
2287
- /* @__PURE__ */ jsx(Popper_default.Portal, { children: popper })
2288
- ]
2289
- }
2290
- ) }) });
2652
+ SplitButton.Menu = SplitButtonMenu;
2653
+ var SplitButton_default = SplitButton;
2654
+
2655
+ // src/components/Buttons/SplitButton/SplitButton.types.ts
2656
+ var SplitButtonSizeVariants = {
2657
+ S: "S",
2658
+ M: "M"
2291
2659
  };
2292
- Dropdown.Button = DropdownButton;
2293
- Dropdown.Content = DropdownContent;
2294
- var Dropdown_default = Dropdown;
2295
- var Container2 = styled6.div`
2660
+ var SplitButtonStyleVariants = {
2661
+ PRIMARY: "PRIMARY",
2662
+ SECONDARY: "SECONDARY"
2663
+ };
2664
+ var informationStyle = css`
2665
+ background: ${colorTokens.neutral100};
2666
+ & > span {
2667
+ color: ${colorTokens.neutral600};
2668
+ }
2669
+ & > svg > path {
2670
+ fill: ${colorTokens.neutral600};
2671
+ }
2672
+ `;
2673
+ var alertStyle = css`
2674
+ background: ${colorTokens.red100};
2675
+ & > span {
2676
+ align-self: center;
2677
+ color: ${colorTokens.red300};
2678
+ }
2679
+ & > svg > path {
2680
+ fill: ${colorTokens.red300};
2681
+ }
2682
+ `;
2683
+ var StyledCallout = styled6.div`
2296
2684
  display: flex;
2297
- align-items: center;
2298
- justify-content: center;
2299
- width: 24px;
2300
- height: 24px;
2301
- padding: 4px;
2685
+ justify-content: flex-start;
2686
+ align-items: start;
2687
+ padding: 6px 8px;
2688
+ gap: 4px;
2689
+ border-radius: ${borderRadiusTokens.borderRadius08};
2690
+ ${({ styleVar }) => styleVar === "INFORMATION" && informationStyle}
2691
+ ${({ styleVar }) => styleVar === "ALERT" && alertStyle}
2302
2692
  `;
2303
- var IconButton2 = styled6.button`
2693
+ var StyledCalloutIcon = styled6.svg`
2304
2694
  display: flex;
2305
- width: 16px;
2306
- height: 16px;
2307
- flex-direction: column;
2308
- justify-content: center;
2309
- align-items: center;
2310
- border-radius: ${borderRadiusTokens.borderRadius04};
2311
- border: none;
2312
- background: ${({ color }) => colorTokens[color]};
2313
- cursor: pointer;
2314
- transition:
2315
- transform 0.1s ease-out,
2316
- background 0.1s ease;
2695
+ height: 20px;
2696
+ min-height: 20px;
2697
+ width: 20px;
2698
+ min-width: 20px;
2699
+ `;
2700
+ styled6.div`
2701
+ padding: 2px 0;
2702
+ `;
2703
+ var Callout = (_a) => {
2704
+ var _b = _a, { children, styleVar = "INFORMATION" } = _b, rest = __objRest(_b, ["children", "styleVar"]);
2705
+ return /* @__PURE__ */ jsx(StyledCallout, __spreadProps(__spreadValues({}, rest), { styleVar, "data-shoplflow": "Callout", children }));
2706
+ };
2707
+ var CalloutText = (_a) => {
2708
+ var _b = _a, { children } = _b, rest = __objRest(_b, ["children"]);
2709
+ return /* @__PURE__ */ jsx(Text_default, __spreadProps(__spreadValues({}, rest), { typography: "paragraph2", children }));
2710
+ };
2711
+ var CalloutIcon = ({ iconSource }) => {
2712
+ return /* @__PURE__ */ jsx(StyledCalloutIcon, { as: iconSource });
2713
+ };
2714
+ Callout.Text = CalloutText;
2715
+ Callout.Icon = CalloutIcon;
2716
+ var Callout_default = Callout;
2317
2717
 
2318
- &:hover {
2319
- background: ${({ color }) => colorTokens[getNextColor(color, 1)]};
2718
+ // src/components/Callout/Callout.types.ts
2719
+ var CalloutTypes = {
2720
+ INFORMATION: "INFORMATION",
2721
+ ALERT: "ALERT"
2722
+ };
2723
+ var getDropdownHeightBySizeVar = (size2) => {
2724
+ switch (size2) {
2725
+ case "M":
2726
+ return "40px";
2727
+ case "S":
2728
+ return "32px";
2729
+ default:
2730
+ return "40px";
2320
2731
  }
2321
- `;
2322
- var MUNUS_BUTTON_SYMBOL_KEY = Symbol("SHOPLFLOW_MUNUS_BUTTON");
2323
- var MinusButton = forwardRef((_a, ref) => {
2324
- var _b = _a, { onClick, color = "neutral300" } = _b, rest = __objRest(_b, ["onClick", "color"]);
2325
- return /* @__PURE__ */ jsx(Container2, { "data-shoplflow": "minusButton", children: /* @__PURE__ */ jsx(IconButton2, __spreadProps(__spreadValues({ color, onClick, ref }, rest), { children: /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
2326
- /* @__PURE__ */ jsx(
2327
- "path",
2328
- {
2329
- 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",
2330
- fill: "none"
2331
- }
2332
- ),
2333
- /* @__PURE__ */ jsx(
2334
- "path",
2335
- {
2336
- fillRule: "evenodd",
2337
- clipRule: "evenodd",
2338
- 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",
2339
- fill: "white"
2340
- }
2341
- )
2342
- ] }) })) });
2343
- });
2344
- MinusButton[MUNUS_BUTTON_SYMBOL_KEY] = true;
2345
- var MinusButton_default = MinusButton;
2346
- var getStylesByStyleVariant = (styleVariant, isSelected, isHovered) => {
2347
- switch (styleVariant) {
2348
- case "PRIMARY":
2349
- if (isSelected) {
2350
- return css`
2351
- background: ${colorTokens.primary300};
2352
- border: 1.5px solid ${colorTokens.primary300};
2353
- & > svg > path {
2354
- fill: ${colorTokens.neutral0};
2355
- }
2356
- ${isHovered && css`
2357
- border: 1.5px solid ${colorTokens.primary400};
2358
- background: ${colorTokens.primary400};
2359
- `}
2360
- `;
2361
- }
2732
+ };
2733
+ var getDropdownFontSizeBySizeVar = (size2) => {
2734
+ switch (size2) {
2735
+ case "M":
2736
+ return "body1_400";
2737
+ case "S":
2738
+ return "body2_400";
2739
+ default:
2740
+ return "body1_400";
2741
+ }
2742
+ };
2743
+ var getDropdownStyleBySizeVar = (size2) => {
2744
+ switch (size2) {
2745
+ case "M":
2362
2746
  return css`
2363
- background: ${colorTokens.neutral200};
2364
- border: 1.5px solid ${colorTokens.neutral200};
2365
- border-radius: 4px;
2366
- ${isHovered && css`
2367
- border: 1.5px solid ${colorTokens.neutral300};
2368
- background: ${colorTokens.neutral300};
2369
- `}
2370
-
2371
- & > svg > path {
2372
- fill: ${colorTokens.neutral0};
2373
- }
2747
+ padding: 4px 4px 4px 12px;
2748
+ `;
2749
+ case "S":
2750
+ return css`
2751
+ padding: 4px 4px 4px 8px;
2752
+ gap: 4px;
2753
+ `;
2754
+ default:
2755
+ return css`
2756
+ padding: 4px 4px 4px 12px;
2757
+ `;
2758
+ }
2759
+ };
2760
+ var getDropdownIconSizeBySizeVar = (size2) => {
2761
+ switch (size2) {
2762
+ case "S":
2763
+ return css`
2764
+ height: 24px;
2765
+ width: 24px;
2766
+ min-width: 24px;
2767
+ min-height: 24px;
2374
2768
  `;
2375
- case "LINE":
2376
- if (isSelected) {
2377
- return css`
2378
- border: 1.5px solid ${colorTokens.primary300};
2379
- background: transparent;
2380
- border-radius: 4px;
2381
- & > svg > path {
2382
- fill: ${colorTokens.primary300};
2383
- }
2384
- ${isHovered && css`
2385
- border: 1.5px solid ${colorTokens.primary400};
2386
- & > svg > path {
2387
- fill: ${colorTokens.primary400};
2388
- }
2389
- `}
2390
- `;
2391
- }
2769
+ case "M":
2392
2770
  return css`
2393
- background: transparent;
2394
- border: 1.5px solid ${colorTokens.neutral200};
2395
- border-radius: 4px;
2396
- & > svg > path {
2397
- fill: ${colorTokens.neutral200};
2398
- }
2399
- ${isHovered && css`
2400
- border: 1.5px solid ${colorTokens.neutral300};
2401
- & > svg > path {
2402
- fill: ${colorTokens.neutral300};
2403
- }
2404
- `}
2771
+ height: 32px;
2772
+ width: 32px;
2773
+ min-width: 32px;
2774
+ min-height: 32px;
2405
2775
  `;
2406
2776
  default:
2407
- return "";
2777
+ return css`
2778
+ height: 32px;
2779
+ width: 32px;
2780
+ min-width: 32px;
2781
+ min-height: 32px;
2782
+ `;
2408
2783
  }
2409
2784
  };
2410
- var StyledCheckHiddenInput = styled6.input`
2411
- position: absolute;
2412
- width: 0;
2413
- height: 0;
2414
- opacity: 0;
2415
- visibility: hidden;
2785
+ var StyledDropdown = styled6.div`
2786
+ width: ${({ width }) => width};
2416
2787
  `;
2417
- var StyledCheckbox = styled6.label`
2788
+ var StyledDropdownContent = styled6.div`
2789
+ display: flex;
2790
+ flex-direction: column;
2791
+ background: ${colorTokens.neutral0};
2792
+ width: ${({ width }) => width != null ? width : "240px"};
2793
+ padding: 4px;
2794
+ border-radius: 6px;
2795
+ box-shadow: ${boxShadowTokens.dropShadow};
2796
+ `;
2797
+ var StyledDropdownButton = styled6.button`
2418
2798
  display: flex;
2799
+ flex-direction: row;
2419
2800
  align-items: center;
2420
- justify-content: center;
2421
- min-width: 16px;
2422
- min-height: 16px;
2423
- width: 16px;
2424
- height: 16px;
2425
- background: ${colorTokens.neutral200};
2426
- border-radius: 4px;
2427
- box-sizing: border-box;
2801
+ justify-content: space-between;
2802
+ width: 100%;
2803
+ height: 100%;
2804
+ gap: 8px;
2428
2805
  cursor: pointer;
2429
- ${({ styleVar, isSelected, isHovered }) => getStylesByStyleVariant(styleVar, isSelected, isHovered)};
2430
- ${({ disabled }) => getDisabledStyle(disabled)}
2806
+ background-color: ${colorTokens.neutral0};
2807
+ ${({ sizeVar }) => sizeVar && getDropdownStyleBySizeVar(sizeVar)};
2808
+ ${({ disabled }) => disabled && css`
2809
+ background-color: ${colorTokens.neutral100};
2810
+ cursor: not-allowed;
2811
+ `}
2431
2812
  `;
2432
- var Container3 = styled6.button`
2813
+ var DropdownButtonIcon = styled6(motion.div)`
2433
2814
  display: flex;
2434
2815
  align-items: center;
2435
2816
  justify-content: center;
2436
- padding: 4px;
2437
- width: fit-content;
2438
- height: fit-content;
2439
- background-color: transparent;
2817
+
2818
+ ${({ sizeVar }) => sizeVar && getDropdownIconSizeBySizeVar(sizeVar)};
2440
2819
  `;
2441
- var CHECKBOX_SYMBOL_KEY = Symbol("SHOPLFLOW_CHECKBOX");
2442
- var Checkbox = forwardRef(
2820
+ var DropdownContext = createContext(null);
2821
+ var useDropdown = () => {
2822
+ const context = useContext(DropdownContext);
2823
+ if (context === null) {
2824
+ throw new Error("useDropdown must be used within a DropdownProvider");
2825
+ }
2826
+ return context;
2827
+ };
2828
+ var getBorderColorByStatus = ({ isFocused, isError, isHovered, disabled }) => {
2829
+ if (!disabled) {
2830
+ if (isError) {
2831
+ return colorTokens.red300;
2832
+ }
2833
+ if (isFocused) {
2834
+ return colorTokens.primary300;
2835
+ }
2836
+ if (isHovered) {
2837
+ return colorTokens.neutral700;
2838
+ }
2839
+ }
2840
+ return colorTokens.neutral300;
2841
+ };
2842
+ var getStyleByType = ({
2843
+ type,
2844
+ height,
2845
+ minHeight,
2846
+ maxHeight,
2847
+ width,
2848
+ minWidth,
2849
+ maxWidth,
2850
+ borderRadius,
2851
+ customNumberInputHeight
2852
+ }) => {
2853
+ if (type === "number") {
2854
+ return css`
2855
+ width: ${width || "64px"};
2856
+ height: ${customNumberInputHeight || "32px"};
2857
+ border-radius: ${borderRadius ? borderRadiusTokens[borderRadius] : "6px"};
2858
+ `;
2859
+ }
2860
+ return css`
2861
+ width: ${width || "100%"};
2862
+ min-width: ${minWidth || "initial"};
2863
+ max-width: ${maxWidth || "initial"};
2864
+ height: ${height || "initial"};
2865
+ min-height: ${minHeight || "initial"};
2866
+ max-height: ${maxHeight || "initial"};
2867
+ border-radius: ${borderRadius ? borderRadiusTokens[borderRadius] : "6px"};
2868
+ `;
2869
+ };
2870
+ var InputWrapper = styled6.label`
2871
+ position: relative;
2872
+ display: flex;
2873
+ align-items: center;
2874
+ border-radius: 6px;
2875
+ flex-direction: ${({ direction }) => direction || "row"};
2876
+ ${({ type, height, minHeight, maxHeight, width, maxWidth, minWidth, borderRadius, customNumberInputHeight }) => getStyleByType({
2877
+ customNumberInputHeight,
2878
+ type,
2879
+ height,
2880
+ minHeight,
2881
+ maxHeight,
2882
+ width,
2883
+ maxWidth,
2884
+ minWidth,
2885
+ borderRadius
2886
+ })};
2887
+ justify-content: space-between;
2888
+ gap: ${({ gap }) => gap || "8px"};
2889
+ border: 1px solid ${(props) => getBorderColorByStatus(props)};
2890
+ background-color: ${colorTokens.neutral0};
2891
+ overflow: hidden;
2892
+ ${({ disabled }) => disabled && css`
2893
+ background-color: ${colorTokens.neutral100};
2894
+ cursor: not-allowed;
2895
+ `};
2896
+ `;
2897
+ var DropdownTriggerButton = forwardRef(
2443
2898
  (_a, ref) => {
2444
- var _b = _a, { defaultSelected, isSelected, disabled, onMouseEnter, onClick, onMouseLeave, styleVar = "PRIMARY", id } = _b, rest = __objRest(_b, ["defaultSelected", "isSelected", "disabled", "onMouseEnter", "onClick", "onMouseLeave", "styleVar", "id"]);
2445
- const [selected, toggleSelected] = useOnToggle(isSelected, defaultSelected);
2446
- const [isHovered, toggleHovered] = useState(false);
2447
- const handleMouseLeave = (e) => {
2448
- toggleHovered(false);
2449
- onMouseLeave && onMouseLeave(e);
2899
+ var _b = _a, { width = "100%", onClick, sizeVar = "M", isError, placeholder, value, disabled, leftSource } = _b, rest = __objRest(_b, ["width", "onClick", "sizeVar", "isError", "placeholder", "value", "disabled", "leftSource"]);
2900
+ const { isOpen, setIsOpen } = useDropdown();
2901
+ const [isHovered, setIsHovered] = useState(false);
2902
+ const handleOnClick = (e) => {
2903
+ if (!disabled) {
2904
+ onClick && onClick(e);
2905
+ setIsOpen(!isOpen);
2906
+ }
2450
2907
  };
2451
- const handleMouseEnter = (e) => {
2452
- toggleHovered(true);
2453
- onMouseEnter && onMouseEnter(e);
2908
+ const handleOnMouseEnter = () => {
2909
+ setIsHovered(true);
2454
2910
  };
2455
- const handleClick = (e) => {
2456
- if (disabled) {
2457
- return;
2911
+ const handleOnMouseLeave = () => {
2912
+ setIsHovered(false);
2913
+ };
2914
+ const getTextColor = ({ value: value2, disabled: disabled2 }) => {
2915
+ if (disabled2) {
2916
+ return "neutral350";
2458
2917
  }
2459
- onClick && onClick(e);
2460
- toggleSelected();
2918
+ if (!value2) {
2919
+ return "neutral400";
2920
+ }
2921
+ return "neutral700";
2461
2922
  };
2462
- return /* @__PURE__ */ jsxs(
2463
- Container3,
2923
+ return /* @__PURE__ */ jsx(
2924
+ InputWrapper,
2464
2925
  {
2465
- onClick: handleClick,
2466
- onMouseLeave: handleMouseLeave,
2467
- onMouseEnter: handleMouseEnter,
2926
+ onMouseEnter: handleOnMouseEnter,
2927
+ onMouseLeave: handleOnMouseLeave,
2928
+ isFocused: isOpen,
2929
+ isHovered,
2468
2930
  disabled,
2469
- type: "button",
2470
- "data-shoplflow": "Checkbox",
2471
- children: [
2472
- /* @__PURE__ */ jsx(StyledCheckHiddenInput, __spreadProps(__spreadValues({ type: "checkbox", disabled, id }, rest), { ref })),
2931
+ width,
2932
+ isError,
2933
+ height: getDropdownHeightBySizeVar(sizeVar),
2934
+ children: /* @__PURE__ */ jsxs(StyledDropdownButton, __spreadProps(__spreadValues({ ref, onClick: handleOnClick, disabled }, rest), { sizeVar, children: [
2935
+ leftSource && leftSource,
2936
+ value || /* @__PURE__ */ jsx(
2937
+ Text_default,
2938
+ {
2939
+ typography: getDropdownFontSizeBySizeVar(sizeVar),
2940
+ color: getTextColor({ value, disabled }),
2941
+ textOverflow: "ellipsis",
2942
+ lineClamp: 1,
2943
+ children: placeholder
2944
+ }
2945
+ ),
2473
2946
  /* @__PURE__ */ jsx(
2474
- StyledCheckbox,
2947
+ DropdownButtonIcon,
2475
2948
  {
2476
- styleVar,
2477
- htmlFor: id,
2478
- isHovered,
2479
- isSelected: selected,
2480
- disabled,
2481
- children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "12", height: "8", viewBox: "0 0 12 8", fill: "none", children: /* @__PURE__ */ jsx(
2482
- "path",
2483
- {
2484
- fillRule: "evenodd",
2485
- clipRule: "evenodd",
2486
- 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",
2487
- fill: "white"
2488
- }
2489
- ) })
2949
+ sizeVar,
2950
+ animate: {
2951
+ rotate: isOpen ? 180 : 0
2952
+ },
2953
+ transition: {
2954
+ duration: 0.2
2955
+ },
2956
+ children: /* @__PURE__ */ jsx(Icon_default, { iconSource: DownArrowSolidXsmallIcon, color: "neutral400", sizeVar: "XS" })
2490
2957
  }
2491
2958
  )
2492
- ]
2959
+ ] }))
2493
2960
  }
2494
2961
  );
2495
2962
  }
2496
2963
  );
2497
- Checkbox[CHECKBOX_SYMBOL_KEY] = true;
2498
- var Checkbox_default = Checkbox;
2499
-
2500
- // src/components/ControlButtons/Checkbox/Checkbox.types.ts
2501
- var CheckboxStyleVariants = {
2502
- PRIMARY: "PRIMARY",
2503
- LINE: "LINE"
2504
- };
2505
- var getSelectedStyle = (isHovered) => {
2506
- return css`
2507
- & > svg > circle {
2508
- stroke: ${colorTokens.primary300};
2964
+ var DropdownContent = (_a) => {
2965
+ var _b = _a, { children, width: initialWidth, type, onClick } = _b, rest = __objRest(_b, ["children", "width", "type", "onClick"]);
2966
+ const { width, setIsOpen, option } = useDropdown();
2967
+ const isFillType = type === "FILL";
2968
+ const contentWidth = isFillType ? `${width}px` : initialWidth;
2969
+ const returnCallbackByOption = () => {
2970
+ if (option === "OUTSIDE_CLICK") {
2971
+ return () => setIsOpen(false);
2509
2972
  }
2510
- ${isHovered && css`
2511
- & > svg > circle {
2512
- stroke: ${colorTokens.primary400};
2513
- }
2514
- `}
2515
- `;
2516
- };
2517
- var StyledRadio = styled6.div`
2518
- display: flex;
2519
- align-items: center;
2520
- justify-content: center;
2521
- min-width: 16px;
2522
- min-height: 16px;
2523
- width: 16px;
2524
- height: 16px;
2525
- ${({ isHovered }) => css`
2526
- & > svg > circle {
2527
- stroke: ${colorTokens.neutral200};
2973
+ if (option === "CLICK") {
2974
+ return () => setIsOpen(false);
2528
2975
  }
2529
- ${isHovered && css`
2530
- & > svg > circle {
2531
- stroke: ${colorTokens.neutral300};
2532
- }
2533
- `}
2534
- `}
2535
- cursor: pointer;
2536
- ${({ isSelected, isHovered }) => isSelected && getSelectedStyle(isHovered)}
2537
- ${({ disabled }) => getDisabledStyle(disabled)}
2538
- `;
2539
- var Container4 = styled6.button`
2540
- display: flex;
2541
- align-items: center;
2542
- justify-content: center;
2543
- background: transparent;
2544
- padding: 4px;
2545
- width: fit-content;
2546
- height: fit-content;
2547
- `;
2548
- var RADIO_SYMBOL_KEY = Symbol("SHOPLFLOW_RADIO");
2549
- var Radio = (_a) => {
2550
- var _b = _a, { isSelected, defaultSelected, disabled, onClick, onMouseEnter, onMouseLeave } = _b, rest = __objRest(_b, ["isSelected", "defaultSelected", "disabled", "onClick", "onMouseEnter", "onMouseLeave"]);
2551
- const [selected, toggleSelected] = useOnToggle(isSelected, defaultSelected);
2552
- const [isHovered, toggleHovered] = useState(false);
2553
- const handleMouseLeave = (e) => {
2554
- toggleHovered(false);
2555
- onMouseLeave && onMouseLeave(e);
2556
- };
2557
- const handleMouseEnter = (e) => {
2558
- toggleHovered(true);
2559
- onMouseEnter && onMouseEnter(e);
2976
+ return noop;
2560
2977
  };
2561
2978
  const handleClick = (e) => {
2562
- if (disabled) {
2563
- return;
2564
- }
2565
2979
  onClick && onClick(e);
2566
- toggleSelected();
2980
+ if (option === "CLICK") {
2981
+ setIsOpen(false);
2982
+ }
2567
2983
  };
2568
- return /* @__PURE__ */ jsx(
2569
- Container4,
2570
- __spreadProps(__spreadValues({
2571
- onClick: handleClick,
2572
- onMouseEnter: handleMouseEnter,
2573
- onMouseLeave: handleMouseLeave
2574
- }, rest), {
2575
- "data-shoplflow": "Radio",
2576
- children: /* @__PURE__ */ jsx(StyledRadio, { isSelected: selected, isHovered, disabled, children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "5.5", fill: "white", stroke: "#3299FE", strokeWidth: "5" }) }) })
2577
- })
2578
- );
2579
- };
2580
- Radio[RADIO_SYMBOL_KEY] = true;
2581
- var Radio_default = Radio;
2582
-
2583
- // src/components/Menu/Menu.styled.ts
2584
- var getStylesBySizeVar = (sizeVar) => {
2585
- switch (sizeVar) {
2586
- case "XS":
2587
- return css`
2588
- min-height: 28px;
2589
- `;
2590
- case "S":
2591
- return css`
2592
- min-height: 36px;
2593
- `;
2594
- case "M":
2595
- return css`
2596
- height: 48px;
2597
- `;
2598
- default:
2599
- return css`
2600
- height: 48px;
2601
- `;
2602
- }
2603
- };
2604
- var getFontStylesBySizeVar = (sizeVar) => {
2605
- switch (sizeVar) {
2606
- case "XS":
2607
- return "body2_400";
2608
- case "S":
2609
- return "body1_400";
2610
- case "M":
2611
- return "body1_400";
2612
- default:
2613
- return "body1_400";
2614
- }
2984
+ return /* @__PURE__ */ jsx(OutSideClick, { outsideClick: returnCallbackByOption(), children: /* @__PURE__ */ jsx(StyledDropdownContent, __spreadProps(__spreadValues({ width: contentWidth, onClick: handleClick }, rest), { children })) });
2615
2985
  };
2616
- var StyledMenu = styled6.li`
2617
- display: flex;
2618
- width: 100%;
2619
- flex-direction: row;
2620
- align-items: center;
2621
- padding: 6px;
2622
- gap: 4px;
2623
- border-radius: 4px;
2624
- cursor: pointer;
2625
- background: transparent;
2626
- ${({ sizeVar }) => getStylesBySizeVar(sizeVar)};
2627
- &:hover {
2628
- background: ${colorTokens.neutral400_5};
2629
- }
2630
- ${({ disabled }) => disabled && getDisabledStyle(disabled)}
2631
- ${({ isSelected, leftSource }) => isSelected === true && (!leftSource || leftSource && !leftSource.type[RADIO_SYMBOL_KEY] && !leftSource.type[CHECKBOX_SYMBOL_KEY] && !leftSource.type[MUNUS_BUTTON_SYMBOL_KEY]) && css`
2632
- background: ${colorTokens.neutral200};
2633
- &:hover {
2634
- background: ${colorTokens.neutral200};
2635
- }
2636
- `}
2637
- `;
2638
- var Menu = (_a) => {
2639
- var _b = _a, {
2640
- leftSource,
2641
- rightSource,
2642
- children,
2643
- isSelected,
2644
- defaultSelected = false,
2645
- onClick,
2646
- sizeVar = "XS",
2647
- disabled = false
2648
- } = _b, rest = __objRest(_b, [
2649
- "leftSource",
2650
- "rightSource",
2651
- "children",
2652
- "isSelected",
2653
- "defaultSelected",
2654
- "onClick",
2655
- "sizeVar",
2656
- "disabled"
2657
- ]);
2658
- const [selected, handleToggle] = useOnToggle(isSelected, defaultSelected);
2659
- const LeftSourceClone = leftSource ? React3__default.cloneElement(leftSource, __spreadProps(__spreadValues({}, rest), {
2660
- isSelected
2661
- })) : leftSource;
2662
- const handleOnClick = (e) => {
2663
- !disabled && handleToggle();
2664
- !disabled && onClick && onClick(e);
2665
- };
2666
- return /* @__PURE__ */ jsxs(
2667
- StyledMenu,
2668
- __spreadProps(__spreadValues({
2669
- sizeVar,
2670
- isSelected: selected,
2671
- leftSource,
2672
- onClick: handleOnClick
2673
- }, rest), {
2674
- "data-shoplflow": "Menu",
2986
+ var Dropdown = ({
2987
+ isOpen: initialIsOpen = false,
2988
+ trigger,
2989
+ popper,
2990
+ option = "CLICK",
2991
+ width = "100%"
2992
+ }) => {
2993
+ const [triggerRef, setTriggerRef] = useState(null);
2994
+ const [size2, setSize] = useState({ width: 0, height: 0 });
2995
+ const [isOpen, setIsOpen] = useState(false);
2996
+ useEffect(() => {
2997
+ if (triggerRef) {
2998
+ setSize({
2999
+ width: triggerRef.offsetWidth,
3000
+ height: triggerRef.offsetHeight
3001
+ });
3002
+ }
3003
+ }, [triggerRef]);
3004
+ useEffect(() => {
3005
+ if (initialIsOpen === void 0) {
3006
+ return;
3007
+ }
3008
+ setIsOpen(initialIsOpen);
3009
+ }, [initialIsOpen]);
3010
+ return /* @__PURE__ */ jsx(StyledDropdown, { "data-shoplflow": "Dropdown", width, children: /* @__PURE__ */ jsx(DropdownContext.Provider, { value: __spreadProps(__spreadValues({}, size2), { isOpen, setIsOpen, option }), children: /* @__PURE__ */ jsxs(
3011
+ Popper_default,
3012
+ {
3013
+ offset: 4,
3014
+ autoPlacement: {
3015
+ allowedPlacements: ["bottom-start", "top-start"]
3016
+ },
2675
3017
  children: [
2676
- leftSource && LeftSourceClone,
2677
- /* @__PURE__ */ jsx(Stack_default.Horizontal, { width: "100%", height: "100%", align: "center", className: getFontStylesBySizeVar(sizeVar), children }),
2678
- rightSource && rightSource
3018
+ /* @__PURE__ */ jsx(Popper_default.Trigger, { ref: setTriggerRef, isOpen, width, children: trigger }),
3019
+ /* @__PURE__ */ jsx(Popper_default.Portal, { children: popper })
2679
3020
  ]
2680
- })
2681
- );
2682
- };
2683
- var Menu_default = Menu;
2684
-
2685
- // src/components/Menu/Menu.types.ts
2686
- var MenuSizeVariants = {
2687
- XS: "XS",
2688
- S: "S",
2689
- M: "M"
3021
+ }
3022
+ ) }) });
2690
3023
  };
3024
+ Dropdown.Button = DropdownTriggerButton;
3025
+ Dropdown.Content = DropdownContent;
3026
+ var Dropdown_default = Dropdown;
2691
3027
  var StyledList = styled6.li`
2692
3028
  display: flex;
2693
3029
  flex-direction: row;
@@ -3685,22 +4021,32 @@ var Tooltip = (_a) => {
3685
4021
  }
3686
4022
  onOpenChange == null ? void 0 : onOpenChange(false);
3687
4023
  }, [open, onOpenChange]);
3688
- return /* @__PURE__ */ jsxs(Popper_default, __spreadProps(__spreadValues({ offset: offset4, placement, middlewares: [flip(), shift({ padding: 5 })] }, popperProps), { children: [
3689
- /* @__PURE__ */ jsx(
3690
- Popper_default.Trigger,
3691
- {
3692
- ref: triggerRef,
3693
- isOpen: isOpen || open,
3694
- onMouseOver: showHandler,
3695
- onMouseLeave: hideHandler,
3696
- onFocus: showHandler,
3697
- onBlur: hideHandler,
3698
- style: { display: "flex", alignItems: "center", justifyContent: "center" },
3699
- children: trigger
3700
- }
3701
- ),
3702
- /* @__PURE__ */ jsx(Popper_default.Portal, { ref: portalRef, children: popper })
3703
- ] }));
4024
+ return /* @__PURE__ */ jsxs(
4025
+ Popper_default,
4026
+ __spreadProps(__spreadValues({
4027
+ offset: offset4,
4028
+ placement,
4029
+ middlewares: [flip(), shift({ padding: 5 })],
4030
+ "data-shoplflow": "Tooltip"
4031
+ }, popperProps), {
4032
+ children: [
4033
+ /* @__PURE__ */ jsx(
4034
+ Popper_default.Trigger,
4035
+ {
4036
+ ref: triggerRef,
4037
+ isOpen: isOpen || open,
4038
+ onMouseOver: showHandler,
4039
+ onMouseLeave: hideHandler,
4040
+ onFocus: showHandler,
4041
+ onBlur: hideHandler,
4042
+ style: { display: "flex", alignItems: "center", justifyContent: "center" },
4043
+ children: trigger
4044
+ }
4045
+ ),
4046
+ /* @__PURE__ */ jsx(Popper_default.Portal, { ref: portalRef, children: popper })
4047
+ ]
4048
+ })
4049
+ );
3704
4050
  };
3705
4051
  Tooltip.Content = TooltipContent;
3706
4052
  var Tooltip_default = Tooltip;
@@ -6014,6 +6360,6 @@ classnames/index.js:
6014
6360
  *)
6015
6361
  */
6016
6362
 
6017
- export { AnnualDatepicker_default as AnnualDatepicker, Avatar_default as Avatar, AvatarSizeVariants, Button_default as Button, ButtonSizeVariants, ButtonStyleVariants, CHECKBOX_SYMBOL_KEY, Callout_default as Callout, CalloutTypes, Checkbox_default as Checkbox, CheckboxStyleVariants, ChipButton_default as ChipButton, ChipButtonSizeVariants, ChipButtonStyleVariants, ChipToggle_default as ChipToggle, ChipToggleSizeVariants, ChipToggleStyleVariants, DayDatepicker_default as DayDatepicker, DayDatepickerSizeVariants, Dropdown_default as Dropdown, Icon_default as Icon, IconButton_default as IconButton, IconButtonSizeVariants, IconButtonStyleVariants, IconSizeVariants, Input_default as Input, InputButton_default as InputButton, InputSizeVariants, List_default as List, MODAL_FOOTER_KEY, MODAL_HEADER_KEY, Menu_default as Menu, MenuSizeVariants, MinusButton_default as MinusButton, Modal, ModalContext, ModalHandlerContext, ModalPortal_default as ModalProvider, ModalSize, MonthDatepicker_default as MonthDatepicker, MotionStack, MotionStackContainer, NumberCombobox_default as NumberCombobox, NumberComboboxSizeVariants, Pagination_default as Pagination, Popper_default as Popper, PopperPortal, PopperTrigger, RADIO_SYMBOL_KEY, Radio_default as Radio, ScrollArea_default as ScrollArea, SelectInputButton_default as SelectInputButton, ShoplflowProvider_default as ShoplflowProvider, Stack_default as Stack, StackContainer_default as StackContainer, StyledIcon, StyledStack, StyledStackContainer, Switch_default as Switch, TREE_SYMBOL_KEY, TabSizeVariants, TabStyleVariants, Tabs_default as Tabs, TabsContext, Tag_default as Tag, TagSizeVariants, TagStyleVariants, Text_default as Text, Text2Rows, TextArea_default as TextArea, ToggleButton_default as ToggleButton, ToggleButtonSizeVariants, Tooltip_default as Tooltip, Tree_default as Tree, TreeItem, WeekDatepicker_default as WeekDatepicker, borderRadiusTokens, boxShadowTokens, colorTokens, fontWeightTokens, getDomain, spacingTokens, typographyTokens, useDomain, useHandleModal, useModalValue, useTabs };
6363
+ export { AnnualDatepicker_default as AnnualDatepicker, Avatar_default as Avatar, AvatarSizeVariants, Button_default as Button, ButtonSizeVariants, ButtonStyleVariants, CHECKBOX_SYMBOL_KEY, Callout_default as Callout, CalloutTypes, Checkbox_default as Checkbox, CheckboxStyleVariants, ChipButton_default as ChipButton, ChipButtonSizeVariants, ChipButtonStyleVariants, ChipToggle_default as ChipToggle, ChipToggleSizeVariants, ChipToggleStyleVariants, DayDatepicker_default as DayDatepicker, DayDatepickerSizeVariants, Dropdown_default as Dropdown, DropdownButton_default as DropdownButton, DropdownButtonContext, DropdownButtonSizeVariants, DropdownButtonStyleVariants, Icon_default as Icon, IconButton_default as IconButton, IconButtonSizeVariants, IconButtonStyleVariants, IconSizeVariants, Input_default as Input, InputButton_default as InputButton, InputSizeVariants, List_default as List, MODAL_FOOTER_KEY, MODAL_HEADER_KEY, Menu_default as Menu, MenuSizeVariants, MinusButton_default as MinusButton, Modal, ModalContext, ModalHandlerContext, ModalPortal_default as ModalProvider, ModalSize, MonthDatepicker_default as MonthDatepicker, MotionStack, MotionStackContainer, NumberCombobox_default as NumberCombobox, NumberComboboxSizeVariants, Pagination_default as Pagination, Popper_default as Popper, PopperPortal, PopperTrigger, RADIO_SYMBOL_KEY, Radio_default as Radio, ScrollArea_default as ScrollArea, SelectInputButton_default as SelectInputButton, ShoplflowProvider_default as ShoplflowProvider, SplitButton_default as SplitButton, SplitButtonContext, SplitButtonSizeVariants, SplitButtonStyleVariants, Stack_default as Stack, StackContainer_default as StackContainer, StyledIcon, StyledStack, StyledStackContainer, Switch_default as Switch, TREE_SYMBOL_KEY, TabSizeVariants, TabStyleVariants, Tabs_default as Tabs, TabsContext, Tag_default as Tag, TagSizeVariants, TagStyleVariants, Text_default as Text, Text2Rows, TextArea_default as TextArea, ToggleButton_default as ToggleButton, ToggleButtonSizeVariants, Tooltip_default as Tooltip, Tree_default as Tree, TreeItem, WeekDatepicker_default as WeekDatepicker, borderRadiusTokens, boxShadowTokens, colorTokens, fontWeightTokens, getDomain, spacingTokens, typographyTokens, useDomain, useDropdownButtonContext, useHandleModal, useModalValue, useSplitButtonContext, useTabs };
6018
6364
  //# sourceMappingURL=out.js.map
6019
6365
  //# sourceMappingURL=index.js.map