@fluentui-react-native/stack 0.11.0 → 0.11.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.
Files changed (54) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/lib/Stack.d.ts +7 -13
  3. package/lib/Stack.js +44 -44
  4. package/lib/Stack.js.map +1 -1
  5. package/lib/Stack.settings.d.ts +1 -1
  6. package/lib/Stack.settings.js +51 -51
  7. package/lib/Stack.tokens.d.ts +3 -3
  8. package/lib/Stack.tokens.js +71 -70
  9. package/lib/Stack.types.d.ts +80 -79
  10. package/lib/Stack.types.js +1 -1
  11. package/lib/StackItem/StackItem.d.ts +1 -1
  12. package/lib/StackItem/StackItem.js +5 -5
  13. package/lib/StackItem/StackItem.settings.d.ts +1 -1
  14. package/lib/StackItem/StackItem.settings.js +8 -8
  15. package/lib/StackItem/StackItem.tokens.d.ts +2 -6
  16. package/lib/StackItem/StackItem.tokens.js +13 -13
  17. package/lib/StackItem/StackItem.types.d.ts +43 -43
  18. package/lib/StackItem/StackItem.types.js +1 -1
  19. package/lib/StackUtils.d.ts +4 -7
  20. package/lib/StackUtils.js +35 -33
  21. package/lib/StackUtils.test.win32.d.ts +1 -1
  22. package/lib/StackUtils.test.win32.js +50 -50
  23. package/lib/__tests__/Stack.test.d.ts +1 -1
  24. package/lib/__tests__/Stack.test.js +9 -14
  25. package/lib/index.d.ts +1 -1
  26. package/lib/index.js +1 -1
  27. package/lib-commonjs/Stack.d.ts +7 -13
  28. package/lib-commonjs/Stack.js +88 -107
  29. package/lib-commonjs/Stack.js.map +1 -1
  30. package/lib-commonjs/Stack.settings.d.ts +1 -1
  31. package/lib-commonjs/Stack.settings.js +54 -54
  32. package/lib-commonjs/Stack.tokens.d.ts +3 -3
  33. package/lib-commonjs/Stack.tokens.js +75 -74
  34. package/lib-commonjs/Stack.types.d.ts +80 -79
  35. package/lib-commonjs/Stack.types.js +3 -3
  36. package/lib-commonjs/StackItem/StackItem.d.ts +1 -1
  37. package/lib-commonjs/StackItem/StackItem.js +13 -13
  38. package/lib-commonjs/StackItem/StackItem.settings.d.ts +1 -1
  39. package/lib-commonjs/StackItem/StackItem.settings.js +11 -11
  40. package/lib-commonjs/StackItem/StackItem.tokens.d.ts +2 -6
  41. package/lib-commonjs/StackItem/StackItem.tokens.js +16 -16
  42. package/lib-commonjs/StackItem/StackItem.types.d.ts +43 -43
  43. package/lib-commonjs/StackItem/StackItem.types.js +3 -3
  44. package/lib-commonjs/StackUtils.d.ts +4 -7
  45. package/lib-commonjs/StackUtils.js +37 -35
  46. package/lib-commonjs/StackUtils.test.win32.d.ts +1 -1
  47. package/lib-commonjs/StackUtils.test.win32.js +53 -71
  48. package/lib-commonjs/__tests__/Stack.test.d.ts +1 -1
  49. package/lib-commonjs/__tests__/Stack.test.js +44 -70
  50. package/lib-commonjs/index.d.ts +1 -1
  51. package/lib-commonjs/index.js +11 -31
  52. package/package.json +30 -29
  53. package/src/Stack.tsx +1 -1
  54. package/eslint.config.js +0 -3
@@ -3,14 +3,14 @@ import type { Spacing } from '@fluentui-react-native/framework';
3
3
  import type { IBackgroundColorTokens, IBorderTokens, FontTokens } from '@fluentui-react-native/tokens';
4
4
  import type { IRenderData } from '@uifabricshared/foundation-composable';
5
5
  import type { IStackItemProps } from './StackItem/StackItem.types';
6
- export declare const stackName = 'RNFStack';
6
+ export declare const stackName = "RNFStack";
7
7
  /**
8
8
  * Defines a type made by the union of the different values that the align-items and justify-content flexbox
9
9
  * properties can take.
10
10
  */
11
11
  export type Alignment = ViewStyle['justifyContent'] | 'start' | 'end';
12
12
  export interface IStackStatics {
13
- Item: React.FunctionComponent<IStackItemProps>;
13
+ Item: React.FunctionComponent<IStackItemProps>;
14
14
  }
15
15
  type SpacingGapValue = `${number}px` | `${number}` | keyof Spacing;
16
16
  /**
@@ -18,90 +18,91 @@ type SpacingGapValue = `${number}px` | `${number}` | keyof Spacing;
18
18
  * the right approach
19
19
  */
20
20
  export interface IStackTokens extends FontTokens, IBackgroundColorTokens, IBorderTokens {
21
- /**
22
- * Defines the spacing between Stack children.
23
- * The property is specified as a value for 'row gap', followed optionally by a value for 'column gap'.
24
- * If 'column gap' is omitted, it's set to the same value as 'row gap'.
25
- */
26
- childrenGap?: number | SpacingGapValue | `${SpacingGapValue} ${SpacingGapValue}`;
27
- /**
28
- * Defines a maximum height for the Stack.
29
- */
30
- maxHeight?: DimensionValue;
31
- /**
32
- * Defines a maximum width for the Stack.
33
- */
34
- maxWidth?: DimensionValue;
35
- /**
36
- * Defines the padding to be applied to the Stack contents relative to its border.
37
- */
38
- padding?: number | `${number}px` | keyof Spacing;
39
- /**
40
- * Defines whether to render Stack children horizontally.
41
- * @defaultvalue false
42
- */
43
- horizontal?: boolean;
44
- /**
45
- * Defines whether to render Stack children in the opposite direction (bottom-to-top if it's a vertical Stack and
46
- * right-to-left if it's a horizontal Stack).
47
- * @defaultvalue false
48
- */
49
- reversed?: boolean;
50
- /**
51
- * Defines how to align Stack children horizontally (along the x-axis).
52
- */
53
- horizontalAlign?: Alignment;
54
- /**
55
- * Defines how to align Stack children vertically (along the y-axis).
56
- */
57
- verticalAlign?: Alignment;
58
- /**
59
- * Defines whether the Stack should take up 100% of the height of its parent.
60
- * This property is required to be set to true when using the `grow` flag on children in vertical oriented Stacks.
61
- * Stacks are rendered as block elements and grow horizontally to the container already.
62
- * @defaultvalue false
63
- */
64
- verticalFill?: boolean;
65
- /**
66
- * Defines whether Stack children should not shrink to fit the available space.
67
- * @defaultvalue false
68
- */
69
- disableShrink?: boolean;
70
- /**
71
- * Defines how much to grow the Stack in proportion to its siblings.
72
- */
73
- grow?: boolean | number;
74
- /**
75
- * Defines whether Stack children should wrap onto multiple rows or columns when they are about to overflow
76
- * the size of the Stack.
77
- * @defaultvalue false
78
- */
79
- wrap?: boolean;
80
- /**
81
- * Gap between items, multiplied by theme gap spacing
82
- * Does not work while running Chakra for reasons specific to that engine (refer to https://github.com/microsoft/fluentui-react-native/issues/767)
83
- */
84
- gap?: number;
21
+ /**
22
+ * Defines the spacing between Stack children.
23
+ * The property is specified as a value for 'row gap', followed optionally by a value for 'column gap'.
24
+ * If 'column gap' is omitted, it's set to the same value as 'row gap'.
25
+ */
26
+ childrenGap?: number | SpacingGapValue | `${SpacingGapValue} ${SpacingGapValue}`;
27
+ /**
28
+ * Defines a maximum height for the Stack.
29
+ */
30
+ maxHeight?: DimensionValue;
31
+ /**
32
+ * Defines a maximum width for the Stack.
33
+ */
34
+ maxWidth?: DimensionValue;
35
+ /**
36
+ * Defines the padding to be applied to the Stack contents relative to its border.
37
+ */
38
+ padding?: number | `${number}px` | keyof Spacing;
39
+ /**
40
+ * Defines whether to render Stack children horizontally.
41
+ * @defaultvalue false
42
+ */
43
+ horizontal?: boolean;
44
+ /**
45
+ * Defines whether to render Stack children in the opposite direction (bottom-to-top if it's a vertical Stack and
46
+ * right-to-left if it's a horizontal Stack).
47
+ * @defaultvalue false
48
+ */
49
+ reversed?: boolean;
50
+ /**
51
+ * Defines how to align Stack children horizontally (along the x-axis).
52
+ */
53
+ horizontalAlign?: Alignment;
54
+ /**
55
+ * Defines how to align Stack children vertically (along the y-axis).
56
+ */
57
+ verticalAlign?: Alignment;
58
+ /**
59
+ * Defines whether the Stack should take up 100% of the height of its parent.
60
+ * This property is required to be set to true when using the `grow` flag on children in vertical oriented Stacks.
61
+ * Stacks are rendered as block elements and grow horizontally to the container already.
62
+ * @defaultvalue false
63
+ */
64
+ verticalFill?: boolean;
65
+ /**
66
+ * Defines whether Stack children should not shrink to fit the available space.
67
+ * @defaultvalue false
68
+ */
69
+ disableShrink?: boolean;
70
+ /**
71
+ * Defines how much to grow the Stack in proportion to its siblings.
72
+ */
73
+ grow?: boolean | number;
74
+ /**
75
+ * Defines whether Stack children should wrap onto multiple rows or columns when they are about to overflow
76
+ * the size of the Stack.
77
+ * @defaultvalue false
78
+ */
79
+ wrap?: boolean;
80
+ /**
81
+ * Gap between items, multiplied by theme gap spacing
82
+ * Does not work while running Chakra for reasons specific to that engine (refer to https://github.com/microsoft/fluentui-react-native/issues/767)
83
+ */
84
+ gap?: number;
85
85
  }
86
86
  /**
87
87
  * Base property definitions, these generally match fabric
88
88
  */
89
- export interface IStackProps extends IStackTokens, ViewProps {}
89
+ export interface IStackProps extends IStackTokens, ViewProps {
90
+ }
90
91
  export type IStackSlotProps = {
91
- root: ViewProps;
92
- inner: ViewProps;
92
+ root: ViewProps;
93
+ inner: ViewProps;
93
94
  };
94
95
  export interface IStackType {
95
- props: IStackProps;
96
- tokens: IStackTokens;
97
- slotProps: IStackSlotProps;
98
- statics: IStackStatics;
99
- state: {
100
- gap: IStackProps['gap'];
101
- horizontal: IStackProps['horizontal'];
102
- wrap: IStackProps['wrap'];
103
- };
96
+ props: IStackProps;
97
+ tokens: IStackTokens;
98
+ slotProps: IStackSlotProps;
99
+ statics: IStackStatics;
100
+ state: {
101
+ gap: IStackProps['gap'];
102
+ horizontal: IStackProps['horizontal'];
103
+ wrap: IStackProps['wrap'];
104
+ };
104
105
  }
105
106
  export type IStackRenderData = IRenderData<IStackSlotProps, IStackType['state']>;
106
107
  export {};
107
- //# sourceMappingURL=Stack.types.d.ts.map
108
+ //# sourceMappingURL=Stack.types.d.ts.map
@@ -1,5 +1,5 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.stackName = void 0;
4
4
  exports.stackName = 'RNFStack';
5
- //# sourceMappingURL=Stack.types.js.map
5
+ //# sourceMappingURL=Stack.types.js.map
@@ -2,4 +2,4 @@ import type * as React from 'react';
2
2
  import type { IStackItemProps } from './StackItem.types';
3
3
  export declare const StackItem: React.FunctionComponent<IStackItemProps>;
4
4
  export default StackItem;
5
- //# sourceMappingURL=StackItem.d.ts.map
5
+ //# sourceMappingURL=StackItem.d.ts.map
@@ -1,17 +1,17 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StackItem = void 0;
4
- const react_native_1 = require('react-native');
5
- const adapters_1 = require('@fluentui-react-native/adapters');
6
- const foundation_compose_1 = require('@uifabricshared/foundation-compose');
7
- const StackItem_settings_1 = require('./StackItem.settings');
8
- const StackItem_tokens_1 = require('./StackItem.tokens');
9
- const StackItem_types_1 = require('./StackItem.types');
4
+ const react_native_1 = require("react-native");
5
+ const adapters_1 = require("@fluentui-react-native/adapters");
6
+ const foundation_compose_1 = require("@uifabricshared/foundation-compose");
7
+ const StackItem_settings_1 = require("./StackItem.settings");
8
+ const StackItem_tokens_1 = require("./StackItem.tokens");
9
+ const StackItem_types_1 = require("./StackItem.types");
10
10
  exports.StackItem = (0, foundation_compose_1.compose)({
11
- displayName: StackItem_types_1.stackItemName,
12
- settings: StackItem_settings_1.settings,
13
- slots: { root: { slotType: react_native_1.View, filter: adapters_1.filterViewProps } },
14
- styles: { root: [StackItem_tokens_1.stackItemTokenProcessor] },
11
+ displayName: StackItem_types_1.stackItemName,
12
+ settings: StackItem_settings_1.settings,
13
+ slots: { root: { slotType: react_native_1.View, filter: adapters_1.filterViewProps } },
14
+ styles: { root: [StackItem_tokens_1.stackItemTokenProcessor] },
15
15
  });
16
16
  exports.default = exports.StackItem;
17
- //# sourceMappingURL=StackItem.js.map
17
+ //# sourceMappingURL=StackItem.js.map
@@ -1,4 +1,4 @@
1
1
  import type { IComposeSettings } from '@uifabricshared/foundation-compose';
2
2
  import type { IStackItemType } from './StackItem.types';
3
3
  export declare const settings: IComposeSettings<IStackItemType>;
4
- //# sourceMappingURL=StackItem.settings.d.ts.map
4
+ //# sourceMappingURL=StackItem.settings.d.ts.map
@@ -1,15 +1,15 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.settings = void 0;
4
- const StackItem_types_1 = require('./StackItem.types');
4
+ const StackItem_types_1 = require("./StackItem.types");
5
5
  exports.settings = [
6
- {
7
- root: {
8
- style: {
9
- width: 'auto',
10
- },
6
+ {
7
+ root: {
8
+ style: {
9
+ width: 'auto',
10
+ },
11
+ },
11
12
  },
12
- },
13
- StackItem_types_1.stackItemName,
13
+ StackItem_types_1.stackItemName,
14
14
  ];
15
- //# sourceMappingURL=StackItem.settings.js.map
15
+ //# sourceMappingURL=StackItem.settings.js.map
@@ -2,9 +2,5 @@ import type { ViewProps } from 'react-native';
2
2
  import type { Theme } from '@fluentui-react-native/framework';
3
3
  import type { IStackItemTokens } from './StackItem.types';
4
4
  export declare function _processor(tokenProps: IStackItemTokens): ViewProps;
5
- export declare const stackItemTokenProcessor: import('@fluentui-react-native/tokens').StyleFactoryFunction<
6
- ViewProps,
7
- IStackItemTokens,
8
- Theme
9
- >;
10
- //# sourceMappingURL=StackItem.tokens.d.ts.map
5
+ export declare const stackItemTokenProcessor: import("@fluentui-react-native/tokens").StyleFactoryFunction<ViewProps, IStackItemTokens, Theme>;
6
+ //# sourceMappingURL=StackItem.tokens.d.ts.map
@@ -1,24 +1,24 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.stackItemTokenProcessor = void 0;
4
4
  exports._processor = _processor;
5
- const foundation_tokens_1 = require('@uifabricshared/foundation-tokens');
5
+ const foundation_tokens_1 = require("@uifabricshared/foundation-tokens");
6
6
  const alignMap = {
7
- start: 'flex-start',
8
- end: 'flex-end',
7
+ start: 'flex-start',
8
+ end: 'flex-end',
9
9
  };
10
10
  const _keyProps = ['align', 'disableShrink', 'grow', 'margin', 'shrink', 'verticalFill'];
11
11
  function _processor(tokenProps) {
12
- const { grow, shrink, disableShrink, align, verticalFill, margin } = tokenProps;
13
- return {
14
- style: {
15
- margin,
16
- height: verticalFill ? '100%' : 'auto',
17
- flexShrink: disableShrink || (!grow && !shrink) ? 0 : 1,
18
- flexGrow: typeof grow === 'number' ? grow : grow ? 1 : undefined,
19
- alignSelf: (align && alignMap[align]) || undefined,
20
- },
21
- };
12
+ const { grow, shrink, disableShrink, align, verticalFill, margin } = tokenProps;
13
+ return {
14
+ style: {
15
+ margin,
16
+ height: verticalFill ? '100%' : 'auto',
17
+ flexShrink: disableShrink || (!grow && !shrink) ? 0 : 1,
18
+ flexGrow: typeof grow === 'number' ? grow : grow ? 1 : undefined,
19
+ alignSelf: (align && alignMap[align]) || undefined,
20
+ },
21
+ };
22
22
  }
23
23
  exports.stackItemTokenProcessor = (0, foundation_tokens_1.styleFunction)(_processor, _keyProps);
24
- //# sourceMappingURL=StackItem.tokens.js.map
24
+ //# sourceMappingURL=StackItem.tokens.js.map
@@ -1,52 +1,52 @@
1
1
  import type { DimensionValue, ViewProps } from 'react-native';
2
- export declare const stackItemName = 'RNFStackItem';
2
+ export declare const stackItemName = "RNFStackItem";
3
3
  /**
4
4
  * Stack item props
5
5
  */
6
6
  export interface IStackItemTokens extends ViewProps {
7
- /**
8
- * Defines the margin to be applied to the StackItem relative to its container.
9
- */
10
- margin?: DimensionValue;
11
- /**
12
- * Defines the padding to be applied to the StackItem contents relative to its border.
13
- */
14
- padding?: DimensionValue;
15
- /**
16
- * Defines how much to grow the StackItem in proportion to its siblings.
17
- */
18
- grow?: boolean | number | 'inherit' | 'initial' | 'unset';
19
- /**
20
- * Defines at what ratio should the StackItem shrink to fit the available space.
21
- */
22
- shrink?: boolean | number | 'inherit' | 'initial' | 'unset';
23
- /**
24
- * Defines whether the StackItem should be prevented from shrinking.
25
- * This can be used to prevent a StackItem from shrinking when it is inside of a Stack that has shrinking items.
26
- * @defaultvalue false
27
- */
28
- disableShrink?: boolean;
29
- /**
30
- * Defines how to align the StackItem along the x-axis (for vertical Stacks) or the y-axis (for horizontal Stacks).
31
- */
32
- align?: 'auto' | 'stretch' | 'baseline' | 'start' | 'center' | 'end';
33
- /**
34
- * Defines whether the StackItem should take up 100% of the height of its parent.
35
- * @defaultvalue true
36
- */
37
- verticalFill?: boolean;
38
- /**
39
- * Defines order of the StackItem.
40
- * @defaultvalue 0
41
- */
42
- order?: number | string;
7
+ /**
8
+ * Defines the margin to be applied to the StackItem relative to its container.
9
+ */
10
+ margin?: DimensionValue;
11
+ /**
12
+ * Defines the padding to be applied to the StackItem contents relative to its border.
13
+ */
14
+ padding?: DimensionValue;
15
+ /**
16
+ * Defines how much to grow the StackItem in proportion to its siblings.
17
+ */
18
+ grow?: boolean | number | 'inherit' | 'initial' | 'unset';
19
+ /**
20
+ * Defines at what ratio should the StackItem shrink to fit the available space.
21
+ */
22
+ shrink?: boolean | number | 'inherit' | 'initial' | 'unset';
23
+ /**
24
+ * Defines whether the StackItem should be prevented from shrinking.
25
+ * This can be used to prevent a StackItem from shrinking when it is inside of a Stack that has shrinking items.
26
+ * @defaultvalue false
27
+ */
28
+ disableShrink?: boolean;
29
+ /**
30
+ * Defines how to align the StackItem along the x-axis (for vertical Stacks) or the y-axis (for horizontal Stacks).
31
+ */
32
+ align?: 'auto' | 'stretch' | 'baseline' | 'start' | 'center' | 'end';
33
+ /**
34
+ * Defines whether the StackItem should take up 100% of the height of its parent.
35
+ * @defaultvalue true
36
+ */
37
+ verticalFill?: boolean;
38
+ /**
39
+ * Defines order of the StackItem.
40
+ * @defaultvalue 0
41
+ */
42
+ order?: number | string;
43
43
  }
44
44
  export type IStackItemProps = IStackItemTokens & ViewProps;
45
45
  export interface IStackItemType {
46
- props: IStackItemProps;
47
- slotProps: {
48
- root: ViewProps;
49
- };
50
- tokens: IStackItemTokens;
46
+ props: IStackItemProps;
47
+ slotProps: {
48
+ root: ViewProps;
49
+ };
50
+ tokens: IStackItemTokens;
51
51
  }
52
- //# sourceMappingURL=StackItem.types.d.ts.map
52
+ //# sourceMappingURL=StackItem.types.d.ts.map
@@ -1,5 +1,5 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.stackItemName = void 0;
4
4
  exports.stackItemName = 'RNFStackItem';
5
- //# sourceMappingURL=StackItem.types.js.map
5
+ //# sourceMappingURL=StackItem.types.js.map
@@ -1,7 +1,7 @@
1
1
  import type { Spacing, Theme } from '@fluentui-react-native/framework';
2
2
  export interface IParseGapResult {
3
- rowGap: number;
4
- columnGap: number;
3
+ rowGap: number;
4
+ columnGap: number;
5
5
  }
6
6
  type SpacingGapValue = `${number}px` | `${number}` | keyof Spacing;
7
7
  /**
@@ -10,14 +10,11 @@ type SpacingGapValue = `${number}px` | `${number}` | keyof Spacing;
10
10
  * Returns the separate numerical value of the padding (e.g. 10)
11
11
  * and the CSS unit (e.g. "px").
12
12
  */
13
- export declare function parseGap(
14
- gap: number | SpacingGapValue | `${SpacingGapValue} ${SpacingGapValue}` | undefined,
15
- theme: Theme,
16
- ): IParseGapResult;
13
+ export declare function parseGap(gap: number | SpacingGapValue | `${SpacingGapValue} ${SpacingGapValue}` | undefined, theme: Theme): IParseGapResult;
17
14
  /**
18
15
  * Takes in a padding in a CSS-style format (e.g. 10, "10px"), or a key of a themed spacing value
19
16
  * (e.g. "s1")
20
17
  */
21
18
  export declare function parsePadding(padding: keyof Spacing | number | `${number}px` | undefined, theme: Theme): number | undefined;
22
19
  export {};
23
- //# sourceMappingURL=StackUtils.d.ts.map
20
+ //# sourceMappingURL=StackUtils.d.ts.map
@@ -1,5 +1,5 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseGap = parseGap;
4
4
  exports.parsePadding = parsePadding;
5
5
  /**
@@ -9,15 +9,15 @@ exports.parsePadding = parsePadding;
9
9
  const _spacingKey = 'spacing';
10
10
  // Helper function that converts a themed spacing key (if given) to the corresponding themed spacing value.
11
11
  const _getThemedSpacing = (space, theme) => {
12
- const spacing = theme[_spacingKey];
13
- if (spacing && typeof spacing === 'object' && typeof space === 'string') {
14
- if (spacing.hasOwnProperty(space)) {
15
- space = spacing[space];
12
+ const spacing = theme[_spacingKey];
13
+ if (spacing && typeof spacing === 'object' && typeof space === 'string') {
14
+ if (spacing.hasOwnProperty(space)) {
15
+ space = spacing[space];
16
+ }
16
17
  }
17
- }
18
- const numericalPart = parseFloat(space);
19
- const numericalValue = isNaN(numericalPart) ? 0 : numericalPart;
20
- return numericalValue;
18
+ const numericalPart = parseFloat(space);
19
+ const numericalValue = isNaN(numericalPart) ? 0 : numericalPart;
20
+ return numericalValue;
21
21
  };
22
22
  /**
23
23
  * Takes in a gap size in either a CSS-style format (e.g. 10 or "10px")
@@ -26,36 +26,38 @@ const _getThemedSpacing = (space, theme) => {
26
26
  * and the CSS unit (e.g. "px").
27
27
  */
28
28
  function parseGap(gap, theme) {
29
- const result = {
30
- rowGap: 0,
31
- columnGap: 0,
32
- };
33
- if (gap) {
34
- if (typeof gap === 'number') {
35
- result.rowGap = gap;
36
- result.columnGap = gap;
37
- } else {
38
- const splitGap = gap.split(' ');
39
- if (splitGap.length === 2) {
40
- result.rowGap = _getThemedSpacing(splitGap[0], theme);
41
- result.columnGap = _getThemedSpacing(splitGap[1], theme);
42
- } else {
43
- const calculatedGap = _getThemedSpacing(gap, theme);
44
- result.rowGap = calculatedGap;
45
- result.columnGap = calculatedGap;
46
- }
29
+ const result = {
30
+ rowGap: 0,
31
+ columnGap: 0,
32
+ };
33
+ if (gap) {
34
+ if (typeof gap === 'number') {
35
+ result.rowGap = gap;
36
+ result.columnGap = gap;
37
+ }
38
+ else {
39
+ const splitGap = gap.split(' ');
40
+ if (splitGap.length === 2) {
41
+ result.rowGap = _getThemedSpacing(splitGap[0], theme);
42
+ result.columnGap = _getThemedSpacing(splitGap[1], theme);
43
+ }
44
+ else {
45
+ const calculatedGap = _getThemedSpacing(gap, theme);
46
+ result.rowGap = calculatedGap;
47
+ result.columnGap = calculatedGap;
48
+ }
49
+ }
47
50
  }
48
- }
49
- return result;
51
+ return result;
50
52
  }
51
53
  /**
52
54
  * Takes in a padding in a CSS-style format (e.g. 10, "10px"), or a key of a themed spacing value
53
55
  * (e.g. "s1")
54
56
  */
55
57
  function parsePadding(padding, theme) {
56
- if (padding === undefined || typeof padding === 'number') {
57
- return padding;
58
- }
59
- return _getThemedSpacing(padding, theme);
58
+ if (padding === undefined || typeof padding === 'number') {
59
+ return padding;
60
+ }
61
+ return _getThemedSpacing(padding, theme);
60
62
  }
61
- //# sourceMappingURL=StackUtils.js.map
63
+ //# sourceMappingURL=StackUtils.js.map
@@ -1,2 +1,2 @@
1
1
  export {};
2
- //# sourceMappingURL=StackUtils.test.win32.d.ts.map
2
+ //# sourceMappingURL=StackUtils.test.win32.d.ts.map