@shoplflow/base 0.26.0 → 0.26.3

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.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React$1 from 'react';
3
- import React__default, { ElementType, ComponentPropsWithoutRef, ReactNode, ReactElement, ImgHTMLAttributes, ComponentPropsWithRef, CSSProperties, HTMLAttributes, InputHTMLAttributes, MouseEvent, Ref } from 'react';
3
+ import React__default, { ElementType, ComponentPropsWithoutRef, ReactNode, ReactElement, ImgHTMLAttributes, ForwardRefExoticComponent, PropsWithoutRef, RefAttributes, CSSProperties, HTMLAttributes, ComponentPropsWithRef, InputHTMLAttributes, MouseEvent, Ref } from 'react';
4
4
  import { $Values } from '@shoplflow/utils';
5
5
  import { IconSource } from '@shoplflow/shopl-assets';
6
6
  import { IconSource as IconSource$1 } from '@shoplflow/hada-assets';
@@ -279,7 +279,7 @@ interface AvatarOptionProps extends SizeVariantProps<AvatarSizeVariantType>, Img
279
279
  declare const Avatar: ({ src, badge, ...rest }: AvatarProps) => react_jsx_runtime.JSX.Element;
280
280
 
281
281
  declare type StackGenericProps<T extends StringElementType = 'div'> = RenderConfigProps & StackProps & HTMLPropsWithoutRef<T>;
282
- declare type StackComponentType = <T extends StringElementType = 'div'>(props: StackGenericProps<T> & Pick<ComponentPropsWithRef<T>, 'ref'>) => ReactElement | null;
282
+ declare type StackComponentType = ForwardRefExoticComponent<PropsWithoutRef<StackGenericProps> & RefAttributes<HTMLElement>>;
283
283
  declare type MotionStackComponentType<T extends StringElementType = 'div'> = CustomDomComponent<RenderConfigProps & HTMLPropsWithoutRef<T> & StackProps>;
284
284
  interface StackProps extends StackOptionProps, ChildrenProps {
285
285
  }
@@ -350,7 +350,7 @@ declare const StyledStack: _emotion_styled.StyledComponent<{
350
350
  } & StackOptionProps, React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
351
351
 
352
352
  declare type StackContainerGenericProps<T extends StringElementType = 'div'> = RenderConfigProps & StackContainerProps & HTMLPropsWithoutRef<T>;
353
- declare type StackContainerComponentType = <T extends StringElementType = 'div'>(props: StackContainerGenericProps<T> & Pick<ComponentPropsWithRef<T>, 'ref'>) => ReactElement | null;
353
+ declare type StackContainerComponentType = ForwardRefExoticComponent<PropsWithoutRef<StackContainerGenericProps> & RefAttributes<HTMLElement>>;
354
354
  declare type MotionStackContainerComponentType<T extends StringElementType = 'div'> = CustomDomComponent<RenderConfigProps & HTMLPropsWithoutRef<T> & StackContainerProps>;
355
355
  interface StackContainerProps extends StackContainerOptionProps, ChildrenProps {
356
356
  }
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React$1 from 'react';
3
- import React__default, { ElementType, ComponentPropsWithoutRef, ReactNode, ReactElement, ImgHTMLAttributes, ComponentPropsWithRef, CSSProperties, HTMLAttributes, InputHTMLAttributes, MouseEvent, Ref } from 'react';
3
+ import React__default, { ElementType, ComponentPropsWithoutRef, ReactNode, ReactElement, ImgHTMLAttributes, ForwardRefExoticComponent, PropsWithoutRef, RefAttributes, CSSProperties, HTMLAttributes, ComponentPropsWithRef, InputHTMLAttributes, MouseEvent, Ref } from 'react';
4
4
  import { $Values } from '@shoplflow/utils';
5
5
  import { IconSource } from '@shoplflow/shopl-assets';
6
6
  import { IconSource as IconSource$1 } from '@shoplflow/hada-assets';
@@ -279,7 +279,7 @@ interface AvatarOptionProps extends SizeVariantProps<AvatarSizeVariantType>, Img
279
279
  declare const Avatar: ({ src, badge, ...rest }: AvatarProps) => react_jsx_runtime.JSX.Element;
280
280
 
281
281
  declare type StackGenericProps<T extends StringElementType = 'div'> = RenderConfigProps & StackProps & HTMLPropsWithoutRef<T>;
282
- declare type StackComponentType = <T extends StringElementType = 'div'>(props: StackGenericProps<T> & Pick<ComponentPropsWithRef<T>, 'ref'>) => ReactElement | null;
282
+ declare type StackComponentType = ForwardRefExoticComponent<PropsWithoutRef<StackGenericProps> & RefAttributes<HTMLElement>>;
283
283
  declare type MotionStackComponentType<T extends StringElementType = 'div'> = CustomDomComponent<RenderConfigProps & HTMLPropsWithoutRef<T> & StackProps>;
284
284
  interface StackProps extends StackOptionProps, ChildrenProps {
285
285
  }
@@ -350,7 +350,7 @@ declare const StyledStack: _emotion_styled.StyledComponent<{
350
350
  } & StackOptionProps, React$1.DetailedHTMLProps<React$1.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
351
351
 
352
352
  declare type StackContainerGenericProps<T extends StringElementType = 'div'> = RenderConfigProps & StackContainerProps & HTMLPropsWithoutRef<T>;
353
- declare type StackContainerComponentType = <T extends StringElementType = 'div'>(props: StackContainerGenericProps<T> & Pick<ComponentPropsWithRef<T>, 'ref'>) => ReactElement | null;
353
+ declare type StackContainerComponentType = ForwardRefExoticComponent<PropsWithoutRef<StackContainerGenericProps> & RefAttributes<HTMLElement>>;
354
354
  declare type MotionStackContainerComponentType<T extends StringElementType = 'div'> = CustomDomComponent<RenderConfigProps & HTMLPropsWithoutRef<T> & StackContainerProps>;
355
355
  interface StackContainerProps extends StackContainerOptionProps, ChildrenProps {
356
356
  }
package/dist/index.js CHANGED
@@ -589,7 +589,7 @@ var createStackComponent2 = (stackOption) => forwardRef(function Stack2(_j, ref)
589
589
  margin,
590
590
  padding
591
591
  }, rest), {
592
- "data-shoplflow": "Stack",
592
+ "data-shoplflow": "StackContainer",
593
593
  children: rest.children
594
594
  })
595
595
  );
@@ -698,13 +698,19 @@ var getModalWidthFromSize = (size2) => {
698
698
  return MODAL_SIZE_M;
699
699
  }
700
700
  };
701
- var getModalBodyTopBottomPadding = (isIncludeHeader) => {
701
+ var getModalBodyTopBottomPadding = (isIncludeHeader, sizeVar) => {
702
702
  if (isIncludeHeader) {
703
703
  return css`
704
704
  padding-top: 16px;
705
705
  padding-bottom: 24px;
706
706
  `;
707
707
  }
708
+ if (sizeVar === "FULL") {
709
+ return css`
710
+ padding-top: 0;
711
+ padding-bottom: 0;
712
+ `;
713
+ }
708
714
  return css`
709
715
  padding-top: 24px;
710
716
  padding-bottom: 24px;
@@ -767,10 +773,10 @@ var BodyContainer = styled6.div`
767
773
  flex-direction: column;
768
774
  background: ${colorTokens.neutral0};
769
775
  box-sizing: border-box;
770
- min-height: ${({ minHeight }) => minHeight};
776
+ min-height: ${({ minHeight }) => minHeight}px;
771
777
  max-height: ${({ maxHeight }) => maxHeight}px;
772
778
  flex: 1;
773
- ${({ isIncludeHeader }) => getModalBodyTopBottomPadding(isIncludeHeader)}
779
+ ${({ isIncludeHeader, sizeVar }) => getModalBodyTopBottomPadding(isIncludeHeader, sizeVar)}
774
780
  `;
775
781
  var ModalBodyContainerInner = styled6.div`
776
782
  display: grid;
@@ -787,6 +793,9 @@ var ModalBodyContent = styled6.div`
787
793
  height: 100%;
788
794
  box-sizing: border-box;
789
795
  padding: 0 24px;
796
+ ${({ sizeVar }) => sizeVar === "FULL" && css`
797
+ padding: 0;
798
+ `};
790
799
  background: ${colorTokens.neutral0};
791
800
  `;
792
801
  var FooterContainer = styled6.div`
@@ -922,6 +931,9 @@ var ModalBody = ({
922
931
  }, [isIncludeFooter, isIncludeHeader]);
923
932
  const headerFooterHeight = useMemo(() => getHeaderFooterHeight(), [getHeaderFooterHeight]);
924
933
  const setAutoHeightMin = () => {
934
+ if (sizeVar === "FULL") {
935
+ return windowHeight - topBottomMargin - headerFooterHeight;
936
+ }
925
937
  if (modalContainerHeight) {
926
938
  if (modalContainerHeight <= 1200) {
927
939
  if (windowHeight < modalContainerHeight) {
@@ -935,10 +947,10 @@ var ModalBody = ({
935
947
  }
936
948
  };
937
949
  const setAutoHeightMax = () => {
950
+ if (sizeVar === "FULL") {
951
+ return windowHeight;
952
+ }
938
953
  if (modalContainerHeight) {
939
- if (sizeVar === "FULL") {
940
- return windowHeight;
941
- }
942
954
  if (modalContainerHeight > 1200) {
943
955
  return 1200 - topBottomMargin - headerFooterHeight;
944
956
  }
@@ -967,21 +979,30 @@ var ModalBody = ({
967
979
  }
968
980
  return autoHeightMax;
969
981
  };
970
- return /* @__PURE__ */ jsx(BodyContainer, { isIncludeHeader, minHeight: setAutoHeightMin(), maxHeight: setAutoHeightMax(), children: /* @__PURE__ */ jsx(
971
- ScrollArea_default,
982
+ return /* @__PURE__ */ jsx(
983
+ BodyContainer,
972
984
  {
973
- id: `scrollbar`,
974
- universal: true,
975
- autoHeight: !modalContainerHeight,
976
- autoHeightMin: setAutoHeightMin(),
977
- autoHeightMax: setContentHeightMax(),
978
- style: {
979
- height: "100%",
980
- overflow: "hidden"
981
- },
982
- children: /* @__PURE__ */ jsx(ModalBodyContainerInner, { children: /* @__PURE__ */ jsx(ModalBodyContent, { isIncludeHeader, sizeVar, children }) })
985
+ isIncludeHeader,
986
+ sizeVar,
987
+ minHeight: setAutoHeightMin(),
988
+ maxHeight: setAutoHeightMax(),
989
+ children: /* @__PURE__ */ jsx(
990
+ ScrollArea_default,
991
+ {
992
+ id: `scrollbar`,
993
+ universal: true,
994
+ autoHeight: !modalContainerHeight,
995
+ autoHeightMin: setAutoHeightMin(),
996
+ autoHeightMax: setContentHeightMax(),
997
+ style: {
998
+ height: "100%",
999
+ overflow: "hidden"
1000
+ },
1001
+ children: /* @__PURE__ */ jsx(ModalBodyContainerInner, { children: /* @__PURE__ */ jsx(ModalBodyContent, { isIncludeHeader, sizeVar, children }) })
1002
+ }
1003
+ )
983
1004
  }
984
- ) });
1005
+ );
985
1006
  };
986
1007
  var ModalBody_default = ModalBody;
987
1008
  var ModalHeader = ({ children }) => {