@officesdk/design 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -137,10 +137,8 @@ var Button = ({
137
137
  iconBefore,
138
138
  iconAfter,
139
139
  iconBordered = false,
140
- onClick,
141
140
  children,
142
- className,
143
- style
141
+ ...rest
144
142
  }) => {
145
143
  const isIconOnly = variant === "icon" || !children && !!(iconBefore || iconAfter);
146
144
  const iconOnlyContent = iconBefore || iconAfter;
@@ -154,9 +152,7 @@ var Button = ({
154
152
  $isIconOnly: isIconOnly,
155
153
  $iconBordered: iconBordered,
156
154
  disabled: disabled || loading,
157
- onClick,
158
- className,
159
- style
155
+ ...rest
160
156
  },
161
157
  loading ? /* @__PURE__ */ React11.createElement(React11.Fragment, null, "Loading...") : isIconOnly ? iconOnlyContent : /* @__PURE__ */ React11.createElement(React11.Fragment, null, iconBefore && /* @__PURE__ */ React11.createElement(IconWrapper, { $size: size, $position: "before" }, iconBefore), children, iconAfter && /* @__PURE__ */ React11.createElement(IconWrapper, { $size: size, $position: "after" }, iconAfter))
162
158
  );
@@ -1988,15 +1984,39 @@ var Tabs = ({
1988
1984
  ))));
1989
1985
  };
1990
1986
  Tabs.displayName = "Tab";
1987
+ var Tooltip = ({
1988
+ content,
1989
+ variant = "black",
1990
+ size = "small",
1991
+ children,
1992
+ placement = "top",
1993
+ trigger = ["hover"],
1994
+ overlay,
1995
+ overlayClassName,
1996
+ getPopupContainer,
1997
+ ...rest
1998
+ }) => {
1999
+ const overlayContent = React11.useMemo(() => /* @__PURE__ */ React11.createElement("div", null, content), [content]);
2000
+ const variantClass = `tooltip-variant-${variant}`;
2001
+ const sizeClass = variant === "white" ? `tooltip-size-${size}` : "";
2002
+ const combinedClassName = [variantClass, sizeClass, overlayClassName].filter(Boolean).join(" ");
2003
+ const tooltipProps = {
2004
+ overlay: overlay ?? overlayContent,
2005
+ placement,
2006
+ trigger,
2007
+ destroyTooltipOnHide: false,
2008
+ overlayClassName: combinedClassName,
2009
+ ...getPopupContainer && { getPopupContainer },
2010
+ ...rest
2011
+ };
2012
+ return /* @__PURE__ */ React11.createElement(RcTooltip, { ...tooltipProps }, children);
2013
+ };
2014
+ Tooltip.displayName = "Tooltip";
2015
+ var paddingDistance = "5px";
2016
+ var positionDistance = "0";
1991
2017
  var TooltipGlobalStyles = createGlobalStyle`
1992
2018
  .rc-tooltip {
1993
- position: absolute;
1994
- z-index: 1070;
1995
- display: block;
1996
- visibility: visible;
1997
- font-size: 12px;
1998
- line-height: 1.5;
1999
- opacity: 0;
2019
+ opacity: 1;
2000
2020
  }
2001
2021
 
2002
2022
  .rc-tooltip-hidden {
@@ -2006,65 +2026,30 @@ var TooltipGlobalStyles = createGlobalStyle`
2006
2026
  .rc-tooltip-placement-top,
2007
2027
  .rc-tooltip-placement-topLeft,
2008
2028
  .rc-tooltip-placement-topRight {
2009
- padding-bottom: 8px;
2029
+ padding-bottom: ${paddingDistance};
2010
2030
  }
2011
2031
 
2012
2032
  .rc-tooltip-placement-right,
2013
2033
  .rc-tooltip-placement-rightTop,
2014
2034
  .rc-tooltip-placement-rightBottom {
2015
- padding-left: 8px;
2035
+ padding-left: ${paddingDistance};
2016
2036
  }
2017
2037
 
2018
2038
  .rc-tooltip-placement-bottom,
2019
2039
  .rc-tooltip-placement-bottomLeft,
2020
2040
  .rc-tooltip-placement-bottomRight {
2021
- padding-top: 8px;
2041
+ padding-top: ${paddingDistance};
2022
2042
  }
2023
2043
 
2024
2044
  .rc-tooltip-placement-left,
2025
2045
  .rc-tooltip-placement-leftTop,
2026
2046
  .rc-tooltip-placement-leftBottom {
2027
- padding-right: 8px;
2047
+ padding-right: ${paddingDistance};
2028
2048
  }
2029
2049
 
2030
2050
  .rc-tooltip-inner {
2031
- /* istanbul ignore next - styled-components CSS generation */
2032
- ${({ $variant, $size, theme }) => {
2033
- if ($variant === "black") {
2034
- const config = theme.components.tooltip.black;
2035
- return `
2036
- background: ${config.background};
2037
- border: 1px solid ${config.borderColor};
2038
- color: ${config.color};
2039
- border-radius: ${config.borderRadius};
2040
- padding: ${config.padding};
2041
- box-shadow: ${config.boxShadow};
2042
- font-size: ${config.fontSize};
2043
- line-height: ${config.lineHeight};
2044
- font-weight: ${config.fontWeight};
2045
- max-width: ${config.maxWidth};
2046
- text-align: left;
2047
- text-decoration: none;
2048
- word-wrap: break-word;
2049
- `;
2050
- } else {
2051
- const sizeConfig = theme.components.tooltip.white[$size || "small"];
2052
- return `
2053
- background: ${sizeConfig.background};
2054
- border: 1px solid ${sizeConfig.borderColor};
2055
- color: ${sizeConfig.color};
2056
- border-radius: ${sizeConfig.borderRadius};
2057
- padding: ${sizeConfig.padding};
2058
- box-shadow: ${sizeConfig.boxShadow};
2059
- font-size: ${sizeConfig.fontSize};
2060
- line-height: ${sizeConfig.lineHeight};
2061
- font-weight: ${sizeConfig.fontWeight};
2062
- text-align: left;
2063
- text-decoration: none;
2064
- word-wrap: break-word;
2065
- `;
2066
- }
2067
- }}
2051
+ word-wrap: break-word;
2052
+ min-height: unset;
2068
2053
  }
2069
2054
 
2070
2055
  .rc-tooltip-arrow {
@@ -2075,48 +2060,6 @@ var TooltipGlobalStyles = createGlobalStyle`
2075
2060
  border-style: solid;
2076
2061
  }
2077
2062
 
2078
- /* istanbul ignore next - styled-components CSS generation */
2079
- ${({ $variant, theme }) => {
2080
- const bgColor = $variant === "black" ? theme.components?.tooltip?.black?.background : theme.components?.tooltip?.white?.small?.background;
2081
- return `
2082
- .rc-tooltip-placement-top .rc-tooltip-arrow,
2083
- .rc-tooltip-placement-topLeft .rc-tooltip-arrow,
2084
- .rc-tooltip-placement-topRight .rc-tooltip-arrow {
2085
- bottom: 3px;
2086
- margin-left: -5px;
2087
- border-width: 5px 5px 0;
2088
- border-top-color: ${bgColor};
2089
- }
2090
-
2091
- .rc-tooltip-placement-right .rc-tooltip-arrow,
2092
- .rc-tooltip-placement-rightTop .rc-tooltip-arrow,
2093
- .rc-tooltip-placement-rightBottom .rc-tooltip-arrow {
2094
- left: 3px;
2095
- margin-top: -5px;
2096
- border-width: 5px 5px 5px 0;
2097
- border-right-color: ${bgColor};
2098
- }
2099
-
2100
- .rc-tooltip-placement-left .rc-tooltip-arrow,
2101
- .rc-tooltip-placement-leftTop .rc-tooltip-arrow,
2102
- .rc-tooltip-placement-leftBottom .rc-tooltip-arrow {
2103
- right: 3px;
2104
- margin-top: -5px;
2105
- border-width: 5px 0 5px 5px;
2106
- border-left-color: ${bgColor};
2107
- }
2108
-
2109
- .rc-tooltip-placement-bottom .rc-tooltip-arrow,
2110
- .rc-tooltip-placement-bottomLeft .rc-tooltip-arrow,
2111
- .rc-tooltip-placement-bottomRight .rc-tooltip-arrow {
2112
- top: 3px;
2113
- margin-left: -5px;
2114
- border-width: 0 5px 5px;
2115
- border-bottom-color: ${bgColor};
2116
- }
2117
- `;
2118
- }}
2119
-
2120
2063
  .rc-tooltip.rc-tooltip-zoom-enter,
2121
2064
  .rc-tooltip.rc-tooltip-zoom-leave {
2122
2065
  display: block;
@@ -2174,20 +2117,161 @@ var TooltipGlobalStyles = createGlobalStyle`
2174
2117
  transform: scale(0, 0);
2175
2118
  }
2176
2119
  }
2120
+
2121
+ /* Black variant */
2122
+ .tooltip-variant-black .rc-tooltip-inner {
2123
+ background: ${({ theme }) => theme.components.tooltip.black.background};
2124
+ border: 1px solid ${({ theme }) => theme.components.tooltip.black.borderColor};
2125
+ color: ${({ theme }) => theme.components.tooltip.black.color};
2126
+ border-radius: ${({ theme }) => theme.components.tooltip.black.borderRadius};
2127
+ padding: ${({ theme }) => theme.components.tooltip.black.padding};
2128
+ box-shadow: ${({ theme }) => theme.components.tooltip.black.boxShadow};
2129
+ font-size: ${({ theme }) => theme.components.tooltip.black.fontSize};
2130
+ line-height: ${({ theme }) => theme.components.tooltip.black.lineHeight};
2131
+ font-weight: ${({ theme }) => theme.components.tooltip.black.fontWeight};
2132
+ max-width: ${({ theme }) => theme.components.tooltip.black.maxWidth};
2133
+ text-align: left;
2134
+ text-decoration: none;
2135
+ }
2136
+
2137
+ .tooltip-variant-black.rc-tooltip-placement-top .rc-tooltip-arrow,
2138
+ .tooltip-variant-black.rc-tooltip-placement-topLeft .rc-tooltip-arrow,
2139
+ .tooltip-variant-black.rc-tooltip-placement-topRight .rc-tooltip-arrow {
2140
+ bottom: ${positionDistance};
2141
+ margin-left: -5px;
2142
+ border-width: 5px 5px 0;
2143
+ border-top-color: ${({ theme }) => theme.components.tooltip.black.background};
2144
+ }
2145
+
2146
+ .tooltip-variant-black.rc-tooltip-placement-right .rc-tooltip-arrow,
2147
+ .tooltip-variant-black.rc-tooltip-placement-rightTop .rc-tooltip-arrow,
2148
+ .tooltip-variant-black.rc-tooltip-placement-rightBottom .rc-tooltip-arrow {
2149
+ left: ${positionDistance};
2150
+ margin-top: -5px;
2151
+ border-width: 5px 5px 5px 0;
2152
+ border-right-color: ${({ theme }) => theme.components.tooltip.black.background};
2153
+ }
2154
+
2155
+ .tooltip-variant-black.rc-tooltip-placement-left .rc-tooltip-arrow,
2156
+ .tooltip-variant-black.rc-tooltip-placement-leftTop .rc-tooltip-arrow,
2157
+ .tooltip-variant-black.rc-tooltip-placement-leftBottom .rc-tooltip-arrow {
2158
+ right: ${positionDistance};
2159
+ margin-top: -5px;
2160
+ border-width: 5px 0 5px 5px;
2161
+ border-left-color: ${({ theme }) => theme.components.tooltip.black.background};
2162
+ }
2163
+
2164
+ .tooltip-variant-black.rc-tooltip-placement-bottom .rc-tooltip-arrow,
2165
+ .tooltip-variant-black.rc-tooltip-placement-bottomLeft .rc-tooltip-arrow,
2166
+ .tooltip-variant-black.rc-tooltip-placement-bottomRight .rc-tooltip-arrow {
2167
+ top: ${positionDistance};
2168
+ margin-left: -5px;
2169
+ border-width: 0 5px 5px;
2170
+ border-bottom-color: ${({ theme }) => theme.components.tooltip.black.background};
2171
+ }
2172
+
2173
+ /* White variant - small size */
2174
+ .tooltip-variant-white.tooltip-size-small .rc-tooltip-inner {
2175
+ background: ${({ theme }) => theme.components.tooltip.white.small.background};
2176
+ border: 1px solid ${({ theme }) => theme.components.tooltip.white.small.borderColor};
2177
+ color: ${({ theme }) => theme.components.tooltip.white.small.color};
2178
+ border-radius: ${({ theme }) => theme.components.tooltip.white.small.borderRadius};
2179
+ padding: ${({ theme }) => theme.components.tooltip.white.small.padding};
2180
+ box-shadow: ${({ theme }) => theme.components.tooltip.white.small.boxShadow};
2181
+ font-size: ${({ theme }) => theme.components.tooltip.white.small.fontSize};
2182
+ line-height: ${({ theme }) => theme.components.tooltip.white.small.lineHeight};
2183
+ font-weight: ${({ theme }) => theme.components.tooltip.white.small.fontWeight};
2184
+ text-align: left;
2185
+ text-decoration: none;
2186
+ }
2187
+
2188
+ .tooltip-variant-white.tooltip-size-small.rc-tooltip-placement-top .rc-tooltip-arrow,
2189
+ .tooltip-variant-white.tooltip-size-small.rc-tooltip-placement-topLeft .rc-tooltip-arrow,
2190
+ .tooltip-variant-white.tooltip-size-small.rc-tooltip-placement-topRight .rc-tooltip-arrow {
2191
+ bottom: ${positionDistance};
2192
+ margin-left: -5px;
2193
+ border-width: 5px 5px 0;
2194
+ border-top-color: ${({ theme }) => theme.components.tooltip.white.small.background};
2195
+ }
2196
+
2197
+ .tooltip-variant-white.tooltip-size-small.rc-tooltip-placement-right .rc-tooltip-arrow,
2198
+ .tooltip-variant-white.tooltip-size-small.rc-tooltip-placement-rightTop .rc-tooltip-arrow,
2199
+ .tooltip-variant-white.tooltip-size-small.rc-tooltip-placement-rightBottom .rc-tooltip-arrow {
2200
+ left: ${positionDistance};
2201
+ margin-top: -5px;
2202
+ border-width: 5px 5px 5px 0;
2203
+ border-right-color: ${({ theme }) => theme.components.tooltip.white.small.background};
2204
+ }
2205
+
2206
+ .tooltip-variant-white.tooltip-size-small.rc-tooltip-placement-left .rc-tooltip-arrow,
2207
+ .tooltip-variant-white.tooltip-size-small.rc-tooltip-placement-leftTop .rc-tooltip-arrow,
2208
+ .tooltip-variant-white.tooltip-size-small.rc-tooltip-placement-leftBottom .rc-tooltip-arrow {
2209
+ right: ${positionDistance};
2210
+ margin-top: -5px;
2211
+ border-width: 5px 0 5px 5px;
2212
+ border-left-color: ${({ theme }) => theme.components.tooltip.white.small.background};
2213
+ }
2214
+
2215
+ .tooltip-variant-white.tooltip-size-small.rc-tooltip-placement-bottom .rc-tooltip-arrow,
2216
+ .tooltip-variant-white.tooltip-size-small.rc-tooltip-placement-bottomLeft .rc-tooltip-arrow,
2217
+ .tooltip-variant-white.tooltip-size-small.rc-tooltip-placement-bottomRight .rc-tooltip-arrow {
2218
+ top: ${positionDistance};
2219
+ margin-left: -5px;
2220
+ border-width: 0 5px 5px;
2221
+ border-bottom-color: ${({ theme }) => theme.components.tooltip.white.small.background};
2222
+ }
2223
+
2224
+ /* White variant - large size */
2225
+ .tooltip-variant-white.tooltip-size-large .rc-tooltip-inner {
2226
+ background: ${({ theme }) => theme.components.tooltip.white.large.background};
2227
+ border: 1px solid ${({ theme }) => theme.components.tooltip.white.large.borderColor};
2228
+ color: ${({ theme }) => theme.components.tooltip.white.large.color};
2229
+ border-radius: ${({ theme }) => theme.components.tooltip.white.large.borderRadius};
2230
+ padding: ${({ theme }) => theme.components.tooltip.white.large.padding};
2231
+ box-shadow: ${({ theme }) => theme.components.tooltip.white.large.boxShadow};
2232
+ font-size: ${({ theme }) => theme.components.tooltip.white.large.fontSize};
2233
+ line-height: ${({ theme }) => theme.components.tooltip.white.large.lineHeight};
2234
+ font-weight: ${({ theme }) => theme.components.tooltip.white.large.fontWeight};
2235
+ text-align: left;
2236
+ text-decoration: none;
2237
+ }
2238
+
2239
+ .tooltip-variant-white.tooltip-size-large.rc-tooltip-placement-top .rc-tooltip-arrow,
2240
+ .tooltip-variant-white.tooltip-size-large.rc-tooltip-placement-topLeft .rc-tooltip-arrow,
2241
+ .tooltip-variant-white.tooltip-size-large.rc-tooltip-placement-topRight .rc-tooltip-arrow {
2242
+ bottom: ${positionDistance};
2243
+ margin-left: -5px;
2244
+ border-width: 5px 5px 0;
2245
+ border-top-color: ${({ theme }) => theme.components.tooltip.white.large.background};
2246
+ }
2247
+
2248
+ .tooltip-variant-white.tooltip-size-large.rc-tooltip-placement-right .rc-tooltip-arrow,
2249
+ .tooltip-variant-white.tooltip-size-large.rc-tooltip-placement-rightTop .rc-tooltip-arrow,
2250
+ .tooltip-variant-white.tooltip-size-large.rc-tooltip-placement-rightBottom .rc-tooltip-arrow {
2251
+ left: ${positionDistance};
2252
+ margin-top: -5px;
2253
+ border-width: 5px 5px 5px 0;
2254
+ border-right-color: ${({ theme }) => theme.components.tooltip.white.large.background};
2255
+ }
2256
+
2257
+ .tooltip-variant-white.tooltip-size-large.rc-tooltip-placement-left .rc-tooltip-arrow,
2258
+ .tooltip-variant-white.tooltip-size-large.rc-tooltip-placement-leftTop .rc-tooltip-arrow,
2259
+ .tooltip-variant-white.tooltip-size-large.rc-tooltip-placement-leftBottom .rc-tooltip-arrow {
2260
+ right: ${positionDistance};
2261
+ margin-top: -5px;
2262
+ border-width: 5px 0 5px 5px;
2263
+ border-left-color: ${({ theme }) => theme.components.tooltip.white.large.background};
2264
+ }
2265
+
2266
+ .tooltip-variant-white.tooltip-size-large.rc-tooltip-placement-bottom .rc-tooltip-arrow,
2267
+ .tooltip-variant-white.tooltip-size-large.rc-tooltip-placement-bottomLeft .rc-tooltip-arrow,
2268
+ .tooltip-variant-white.tooltip-size-large.rc-tooltip-placement-bottomRight .rc-tooltip-arrow {
2269
+ top: ${positionDistance};
2270
+ margin-left: -5px;
2271
+ border-width: 0 5px 5px;
2272
+ border-bottom-color: ${({ theme }) => theme.components.tooltip.white.large.background};
2273
+ }
2177
2274
  `;
2178
- var Tooltip = ({
2179
- content,
2180
- variant = "black",
2181
- size = "small",
2182
- children,
2183
- placement = "top",
2184
- trigger = ["hover"],
2185
- ...rest
2186
- }) => {
2187
- const GlobalStyles = TooltipGlobalStyles;
2188
- return /* @__PURE__ */ React11.createElement(React11.Fragment, null, /* @__PURE__ */ React11.createElement(GlobalStyles, { $variant: variant, $size: size }), /* @__PURE__ */ React11.createElement(RcTooltip, { overlay: /* @__PURE__ */ React11.createElement("div", null, content), placement, trigger, ...rest }, children));
2189
- };
2190
- Tooltip.displayName = "Tooltip";
2191
2275
  var UIConfigContext = createContext(null);
2192
2276
  var UIConfigProvider = ({
2193
2277
  config,
@@ -2203,7 +2287,8 @@ var UIConfigProvider = ({
2203
2287
  defaultDuration: toast.defaultDuration ?? 3e3
2204
2288
  };
2205
2289
  const Provider = ThemeProvider;
2206
- return /* @__PURE__ */ React11.createElement(UIConfigContext.Provider, { value: config }, /* @__PURE__ */ React11.createElement(Provider, { theme }, /* @__PURE__ */ React11.createElement(IconProvider, { icons }, /* @__PURE__ */ React11.createElement(
2290
+ const TooltipStyles = TooltipGlobalStyles;
2291
+ return /* @__PURE__ */ React11.createElement(UIConfigContext.Provider, { value: config }, /* @__PURE__ */ React11.createElement(Provider, { theme }, /* @__PURE__ */ React11.createElement(TooltipStyles, null), /* @__PURE__ */ React11.createElement(IconProvider, { icons }, /* @__PURE__ */ React11.createElement(
2207
2292
  ToastContainer2,
2208
2293
  {
2209
2294
  maxCount: toastConfig.maxCount,