@draftbit/core 49.4.7 → 49.4.8-21b409.2

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.
@@ -1 +1 @@
1
- import{StyleSheet}from"react-native";import{pick,omit}from"lodash";import{useDeepCompareMemo}from"../../utilities";export var contentContainerStyleNames=["padding","paddingBottom","paddingEnd","paddingHorizontal","paddingLeft","paddingRight","paddingStart","paddingTop","paddingVertical","justifyContent","alignItems","alignContent","flexDirection","flexWrap"];export default function useSplitContentContainerStyles(originalStyle,measuredWidth,measuredHeight){return useDeepCompareMemo(function(){var flattenedStyle=StyleSheet.flatten(originalStyle);var contentContainerStyle=pick(flattenedStyle,contentContainerStyleNames);if(measuredWidth){contentContainerStyle.minWidth=measuredWidth;}if(measuredHeight){contentContainerStyle.minHeight=measuredHeight;}var style=omit(flattenedStyle,contentContainerStyleNames);if(style.flex===undefined){style=Object.assign({flexGrow:0},style);}else if(style.flexGrow===undefined){style=Object.assign({flexGrow:style.flex},style);}return{style:style,contentContainerStyle:contentContainerStyle};},[originalStyle,measuredWidth,measuredHeight]);}
1
+ import{StyleSheet}from"react-native";import{pick,omit}from"lodash";import{useDeepCompareMemo}from"../../utilities";export var contentContainerStyleNames=["padding","paddingBottom","paddingEnd","paddingHorizontal","paddingLeft","paddingRight","paddingStart","paddingTop","paddingVertical","justifyContent","alignItems","alignContent","flexDirection","flexWrap"];export default function useSplitContentContainerStyles(originalStyle,measuredWidth,measuredHeight){return useDeepCompareMemo(function(){var _ref,_flattenedStyle$borde,_ref2,_flattenedStyle$borde2,_ref3,_flattenedStyle$borde3,_ref4,_flattenedStyle$borde4;var flattenedStyle=StyleSheet.flatten(originalStyle);var contentContainerStyle=pick(flattenedStyle,contentContainerStyleNames);var leftBorderWidth=(_ref=(_flattenedStyle$borde=flattenedStyle.borderLeftWidth)!=null?_flattenedStyle$borde:flattenedStyle.borderWidth)!=null?_ref:0;var rightBorderWidth=(_ref2=(_flattenedStyle$borde2=flattenedStyle.borderRightWidth)!=null?_flattenedStyle$borde2:flattenedStyle.borderWidth)!=null?_ref2:0;var topBorderWidth=(_ref3=(_flattenedStyle$borde3=flattenedStyle.borderTopWidth)!=null?_flattenedStyle$borde3:flattenedStyle.borderWidth)!=null?_ref3:0;var bottomBorderWidth=(_ref4=(_flattenedStyle$borde4=flattenedStyle.borderBottomWidth)!=null?_flattenedStyle$borde4:flattenedStyle.borderWidth)!=null?_ref4:0;if(measuredWidth){contentContainerStyle.minWidth=measuredWidth-leftBorderWidth-rightBorderWidth;}if(measuredHeight){contentContainerStyle.minHeight=measuredHeight-topBorderWidth-bottomBorderWidth;}var style=omit(flattenedStyle,contentContainerStyleNames);if(style.flex===undefined){style=Object.assign({flexGrow:0},style);}else if(style.flexGrow===undefined){style=Object.assign({flexGrow:style.flex},style);}return{style:style,contentContainerStyle:contentContainerStyle};},[originalStyle,measuredWidth,measuredHeight]);}
@@ -19,14 +19,22 @@ export const contentContainerStyleNames = [
19
19
  ];
20
20
  export default function useSplitContentContainerStyles(originalStyle, measuredWidth, measuredHeight) {
21
21
  return useDeepCompareMemo(() => {
22
+ var _a, _b, _c, _d, _e, _f, _g, _h;
22
23
  const flattenedStyle = StyleSheet.flatten(originalStyle);
23
24
  let contentContainerStyle = pick(flattenedStyle, contentContainerStyleNames);
24
- // contentContainerStyle should always at least fill the parent to ensure sizing changes reflects properly on component and children
25
+ const leftBorderWidth = (_b = (_a = flattenedStyle.borderLeftWidth) !== null && _a !== void 0 ? _a : flattenedStyle.borderWidth) !== null && _b !== void 0 ? _b : 0;
26
+ const rightBorderWidth = (_d = (_c = flattenedStyle.borderRightWidth) !== null && _c !== void 0 ? _c : flattenedStyle.borderWidth) !== null && _d !== void 0 ? _d : 0;
27
+ const topBorderWidth = (_f = (_e = flattenedStyle.borderTopWidth) !== null && _e !== void 0 ? _e : flattenedStyle.borderWidth) !== null && _f !== void 0 ? _f : 0;
28
+ const bottomBorderWidth = (_h = (_g = flattenedStyle.borderBottomWidth) !== null && _g !== void 0 ? _g : flattenedStyle.borderWidth) !== null && _h !== void 0 ? _h : 0;
29
+ // contentContainerStyle should always at least fill the parent to ensure sizing changes reflects properly on component and children.
30
+ // The measured sizes include borders, so we need to subtract those before applying
25
31
  if (measuredWidth) {
26
- contentContainerStyle.minWidth = measuredWidth;
32
+ contentContainerStyle.minWidth =
33
+ measuredWidth - leftBorderWidth - rightBorderWidth;
27
34
  }
28
35
  if (measuredHeight) {
29
- contentContainerStyle.minHeight = measuredHeight;
36
+ contentContainerStyle.minHeight =
37
+ measuredHeight - topBorderWidth - bottomBorderWidth;
30
38
  }
31
39
  let style = omit(flattenedStyle, contentContainerStyleNames);
32
40
  // ScrollView's implementation defaults flexGrow to 1, which prevents the ability to set a static size or use a flex larger than 1
@@ -1 +1 @@
1
- {"version":3,"file":"useSplitContentContainerStyles.js","sourceRoot":"","sources":["../../../../../src/components/SimpleStyleScrollables/useSplitContentContainerStyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,UAAU,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAOrD,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,SAAS;IACT,eAAe;IACf,YAAY;IACZ,mBAAmB;IACnB,aAAa;IACb,cAAc;IACd,cAAc;IACd,YAAY;IACZ,iBAAiB;IACjB,gBAAgB;IAChB,YAAY;IACZ,cAAc;IACd,eAAe;IACf,UAAU;CACX,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,8BAA8B,CACpD,aAAmC,EACnC,aAAsB,EACtB,cAAuB;IAEvB,OAAO,kBAAkB,CAAS,GAAG,EAAE;QACrC,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAEzD,IAAI,qBAAqB,GAAG,IAAI,CAC9B,cAAc,EACd,0BAA0B,CAC3B,CAAC;QAEF,oIAAoI;QACpI,IAAI,aAAa,EAAE;YACjB,qBAAqB,CAAC,QAAQ,GAAG,aAAa,CAAC;SAChD;QACD,IAAI,cAAc,EAAE;YAClB,qBAAqB,CAAC,SAAS,GAAG,cAAc,CAAC;SAClD;QAED,IAAI,KAAK,GAAG,IAAI,CAAC,cAAc,EAAE,0BAA0B,CAAC,CAAC;QAE7D,kIAAkI;QAClI,4DAA4D;QAC5D,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE;YAC5B,KAAK,GAAG,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC;SACnC;aAAM,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS,EAAE;YACvC,KAAK,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,IAAI,EAAE,GAAG,KAAK,EAAE,CAAC;SAC5C;QAED,OAAO,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC;IAC1C,CAAC,EAAE,CAAC,aAAa,EAAE,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC;AACrD,CAAC"}
1
+ {"version":3,"file":"useSplitContentContainerStyles.js","sourceRoot":"","sources":["../../../../../src/components/SimpleStyleScrollables/useSplitContentContainerStyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,UAAU,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAOrD,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,SAAS;IACT,eAAe;IACf,YAAY;IACZ,mBAAmB;IACnB,aAAa;IACb,cAAc;IACd,cAAc;IACd,YAAY;IACZ,iBAAiB;IACjB,gBAAgB;IAChB,YAAY;IACZ,cAAc;IACd,eAAe;IACf,UAAU;CACX,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,8BAA8B,CACpD,aAAmC,EACnC,aA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