@shoplflow/base 0.12.4 → 0.13.0

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.mjs CHANGED
@@ -6,6 +6,8 @@ import { createPortal } from 'react-dom';
6
6
  import { noop, useParentElementClick, useResizeObserver, isNullOrUndefined } from '@shoplflow/utils';
7
7
  import { css } from '@emotion/react';
8
8
  import Scrollbars from 'react-custom-scrollbars-2';
9
+ import { useFloating } from '@floating-ui/react-dom';
10
+ import { autoUpdate, offset, autoPlacement, FloatingPortal } from '@floating-ui/react';
9
11
  import * as ShoplAssets from '@shoplflow/shopl-assets';
10
12
  import * as HadaAssets from '@shoplflow/hada-assets';
11
13
 
@@ -336,6 +338,7 @@ var body2_500 = ".body2_500";
336
338
  var body2_400 = ".body2_400";
337
339
  var body3_400 = ".body3_400";
338
340
  var body3_500 = ".body3_500";
341
+ var caption_700 = ".caption_700";
339
342
  var caption_400 = ".caption_400";
340
343
  var typographyTokens = {
341
344
  heading1_700,
@@ -357,6 +360,7 @@ var typographyTokens = {
357
360
  body2_400,
358
361
  body3_400,
359
362
  body3_500,
363
+ caption_700,
360
364
  caption_400
361
365
  };
362
366
  var StyledStack = styled5.div`
@@ -1049,6 +1053,7 @@ var StyledButton = styled5.button`
1049
1053
  display: flex;
1050
1054
  align-items: center;
1051
1055
  justify-content: center;
1056
+ height: fit-content;
1052
1057
  gap: 4px;
1053
1058
  padding: 0 12px;
1054
1059
  border-radius: 6px;
@@ -1261,6 +1266,54 @@ var CalloutTypes = {
1261
1266
  INFORMATION: "INFORMATION",
1262
1267
  ALERT: "ALERT"
1263
1268
  };
1269
+ var StyledPopper = styled5.div`
1270
+ display: flex;
1271
+ flex-direction: row;
1272
+ width: ${({ width }) => width ?? "fit-content"};
1273
+ height: ${({ height }) => height ?? "fit-content"};
1274
+ `;
1275
+ var Popper = ({
1276
+ trigger,
1277
+ popper,
1278
+ isOpen = false,
1279
+ placement,
1280
+ offset: initialOffset = 0,
1281
+ autoPlacement: initialAutoPlacement,
1282
+ strategy = "absolute",
1283
+ middlewares,
1284
+ animation: initialAnimation,
1285
+ ...rest
1286
+ }) => {
1287
+ const { refs, floatingStyles } = useFloating({
1288
+ strategy,
1289
+ placement,
1290
+ whileElementsMounted: autoUpdate,
1291
+ middleware: [
1292
+ offset(initialOffset),
1293
+ autoPlacement({
1294
+ crossAxis: false,
1295
+ ...initialAutoPlacement
1296
+ }),
1297
+ ...middlewares ?? []
1298
+ ]
1299
+ });
1300
+ const animation = initialAnimation ?? fadeInOut;
1301
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1302
+ /* @__PURE__ */ jsx(StyledPopper, { ref: refs.setReference, "data-shoplflow": "Popper", ...rest, children: trigger }),
1303
+ /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(AnimatePresence, { children: isOpen && /* @__PURE__ */ jsx(
1304
+ motion.div,
1305
+ {
1306
+ initial: animation.initial,
1307
+ animate: animation.animate,
1308
+ exit: animation.exit,
1309
+ ref: refs.setFloating,
1310
+ style: floatingStyles,
1311
+ children: popper
1312
+ }
1313
+ ) }) })
1314
+ ] });
1315
+ };
1316
+ var Popper_default = Popper;
1264
1317
 
1265
1318
  // src/components/Icon/Icon.types.ts
1266
1319
  var IconSizeVariants = {
@@ -1697,6 +1750,6 @@ var MinusButton = forwardRef(({ onClick, color = "neutral300", ...rest }, ref) =
1697
1750
  });
1698
1751
  var MinusButton_default = MinusButton;
1699
1752
 
1700
- export { Button_default as Button, Callout_default as Callout, CalloutTypes, ChipButton_default as ChipButton, ChipButtonSizeVariants, ChipButtonStyleVariants, ChipToggle_default as ChipToggle, ChipToggleSizeVariants, ChipToggleStyleVariants, Icon_default as Icon, IconButton_default as IconButton, IconSizeVariants, MODAL_FOOTER_KEY, MODAL_HEADER_KEY, MinusButton_default as MinusButton, Modal, ModalPortal_default as ModalProvider, ModalSize, MotionStack, ShoplflowProvider_default as ShoplflowProvider, Stack_default as Stack, StyledIcon, StyledStack, Switch_default as Switch, Text_default as Text, TextArea_default as TextArea, borderRadiusTokens, boxShadowTokens, buttonSizeVar, buttonStyleVar, colorTokens, fontWeightTokens, getDomain, iconButtonSizeVar, iconButtonStyleVar, spacingTokens, typographyTokens, useDomain, useHandleModal, useModalValue };
1753
+ export { Button_default as Button, Callout_default as Callout, CalloutTypes, ChipButton_default as ChipButton, ChipButtonSizeVariants, ChipButtonStyleVariants, ChipToggle_default as ChipToggle, ChipToggleSizeVariants, ChipToggleStyleVariants, Icon_default as Icon, IconButton_default as IconButton, IconSizeVariants, MODAL_FOOTER_KEY, MODAL_HEADER_KEY, MinusButton_default as MinusButton, Modal, ModalPortal_default as ModalProvider, ModalSize, MotionStack, Popper_default as Popper, ShoplflowProvider_default as ShoplflowProvider, Stack_default as Stack, StyledIcon, StyledPopper, StyledStack, Switch_default as Switch, Text_default as Text, TextArea_default as TextArea, borderRadiusTokens, boxShadowTokens, buttonSizeVar, buttonStyleVar, colorTokens, fontWeightTokens, getDomain, iconButtonSizeVar, iconButtonStyleVar, spacingTokens, typographyTokens, useDomain, useHandleModal, useModalValue };
1701
1754
  //# sourceMappingURL=out.js.map
1702
1755
  //# sourceMappingURL=index.mjs.map