@fluentui-react-native/stack 0.11.0 → 0.11.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.
Files changed (50) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/lib/Stack.d.ts +7 -13
  3. package/lib/Stack.js +44 -44
  4. package/lib/Stack.settings.d.ts +1 -1
  5. package/lib/Stack.settings.js +51 -51
  6. package/lib/Stack.tokens.d.ts +3 -3
  7. package/lib/Stack.tokens.js +71 -70
  8. package/lib/Stack.types.d.ts +80 -79
  9. package/lib/Stack.types.js +1 -1
  10. package/lib/StackItem/StackItem.d.ts +1 -1
  11. package/lib/StackItem/StackItem.js +5 -5
  12. package/lib/StackItem/StackItem.settings.d.ts +1 -1
  13. package/lib/StackItem/StackItem.settings.js +8 -8
  14. package/lib/StackItem/StackItem.tokens.d.ts +2 -6
  15. package/lib/StackItem/StackItem.tokens.js +13 -13
  16. package/lib/StackItem/StackItem.types.d.ts +43 -43
  17. package/lib/StackItem/StackItem.types.js +1 -1
  18. package/lib/StackUtils.d.ts +4 -7
  19. package/lib/StackUtils.js +35 -33
  20. package/lib/StackUtils.test.win32.d.ts +1 -1
  21. package/lib/StackUtils.test.win32.js +50 -50
  22. package/lib/__tests__/Stack.test.d.ts +1 -1
  23. package/lib/__tests__/Stack.test.js +9 -14
  24. package/lib/index.d.ts +1 -1
  25. package/lib/index.js +1 -1
  26. package/lib-commonjs/Stack.d.ts +7 -13
  27. package/lib-commonjs/Stack.js +88 -107
  28. package/lib-commonjs/Stack.settings.d.ts +1 -1
  29. package/lib-commonjs/Stack.settings.js +54 -54
  30. package/lib-commonjs/Stack.tokens.d.ts +3 -3
  31. package/lib-commonjs/Stack.tokens.js +75 -74
  32. package/lib-commonjs/Stack.types.d.ts +80 -79
  33. package/lib-commonjs/Stack.types.js +3 -3
  34. package/lib-commonjs/StackItem/StackItem.d.ts +1 -1
  35. package/lib-commonjs/StackItem/StackItem.js +13 -13
  36. package/lib-commonjs/StackItem/StackItem.settings.d.ts +1 -1
  37. package/lib-commonjs/StackItem/StackItem.settings.js +11 -11
  38. package/lib-commonjs/StackItem/StackItem.tokens.d.ts +2 -6
  39. package/lib-commonjs/StackItem/StackItem.tokens.js +16 -16
  40. package/lib-commonjs/StackItem/StackItem.types.d.ts +43 -43
  41. package/lib-commonjs/StackItem/StackItem.types.js +3 -3
  42. package/lib-commonjs/StackUtils.d.ts +4 -7
  43. package/lib-commonjs/StackUtils.js +37 -35
  44. package/lib-commonjs/StackUtils.test.win32.d.ts +1 -1
  45. package/lib-commonjs/StackUtils.test.win32.js +53 -71
  46. package/lib-commonjs/__tests__/Stack.test.d.ts +1 -1
  47. package/lib-commonjs/__tests__/Stack.test.js +44 -70
  48. package/lib-commonjs/index.d.ts +1 -1
  49. package/lib-commonjs/index.js +11 -31
  50. package/package.json +22 -21
@@ -1,74 +1,56 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
3
- const StackUtils_1 = require('./StackUtils');
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const StackUtils_1 = require("./StackUtils");
4
4
  describe('StackUtils', () => {
5
- describe('parseGap', () => {
6
- const theme = {
7
- spacing: { m: '16em' },
8
- };
9
- it('returns a default value when given undefined', () => {
10
- expect((0, StackUtils_1.parseGap)(undefined, theme)).toEqual({
11
- rowGap: { value: 0, unit: 'px' },
12
- columnGap: { value: 0, unit: 'px' },
13
- });
5
+ describe('parseGap', () => {
6
+ const theme = {
7
+ spacing: { m: '16em' },
8
+ };
9
+ it('returns a default value when given undefined', () => {
10
+ expect((0, StackUtils_1.parseGap)(undefined, theme)).toEqual({ rowGap: { value: 0, unit: 'px' }, columnGap: { value: 0, unit: 'px' } });
11
+ });
12
+ it('returns a value with px when given a number', () => {
13
+ expect((0, StackUtils_1.parseGap)(10, theme)).toEqual({ rowGap: { value: 10, unit: 'px' }, columnGap: { value: 10, unit: 'px' } });
14
+ });
15
+ it('can parse a string with px', () => {
16
+ expect((0, StackUtils_1.parseGap)('32px', theme)).toEqual({ rowGap: { value: 32, unit: 'px' }, columnGap: { value: 32, unit: 'px' } });
17
+ });
18
+ it('can parse a string with a float', () => {
19
+ expect((0, StackUtils_1.parseGap)('20.5px', theme)).toEqual({ rowGap: { value: 20.5, unit: 'px' }, columnGap: { value: 20.5, unit: 'px' } });
20
+ });
21
+ it('parses the value from the theme when given a spacing key', () => {
22
+ expect((0, StackUtils_1.parseGap)('m', theme)).toEqual({ rowGap: { value: 16, unit: 'em' }, columnGap: { value: 16, unit: 'em' } });
23
+ });
24
+ it('can parse a string with both horizontal and vertical gap', () => {
25
+ expect((0, StackUtils_1.parseGap)('30px 10px', theme)).toEqual({ rowGap: { value: 30, unit: 'px' }, columnGap: { value: 10, unit: 'px' } });
26
+ });
27
+ it('defaults to px with a string with horizontal and vertical gap with no units', () => {
28
+ expect((0, StackUtils_1.parseGap)('50 30', theme)).toEqual({ rowGap: { value: 50, unit: 'px' }, columnGap: { value: 30, unit: 'px' } });
29
+ });
30
+ it('can parse a string with horizontal and vertical gap with one of them getting value from the theme when given a spacing key', () => {
31
+ expect((0, StackUtils_1.parseGap)('50px m', theme)).toEqual({ rowGap: { value: 50, unit: 'px' }, columnGap: { value: 16, unit: 'em' } });
32
+ });
33
+ });
34
+ describe('parsePadding', () => {
35
+ const theme = {
36
+ spacing: {
37
+ s2: '5px',
38
+ s1: '10px',
39
+ m: '15px',
40
+ l1: '20px',
41
+ l2: '25px',
42
+ },
43
+ };
44
+ it('returns its argument when given undefined, a number, or an empty string', () => {
45
+ expect((0, StackUtils_1.parsePadding)(undefined, theme)).toEqual(undefined);
46
+ expect((0, StackUtils_1.parsePadding)(0, theme)).toEqual(0);
47
+ });
48
+ it('returns its argument when given a CSS-style padding', () => {
49
+ expect((0, StackUtils_1.parsePadding)('10px', theme)).toEqual('10px');
50
+ });
51
+ it('converts themed spacing keys to CSS-style paddings', () => {
52
+ expect((0, StackUtils_1.parsePadding)('s2', theme)).toEqual('5px');
53
+ });
14
54
  });
15
- it('returns a value with px when given a number', () => {
16
- expect((0, StackUtils_1.parseGap)(10, theme)).toEqual({ rowGap: { value: 10, unit: 'px' }, columnGap: { value: 10, unit: 'px' } });
17
- });
18
- it('can parse a string with px', () => {
19
- expect((0, StackUtils_1.parseGap)('32px', theme)).toEqual({
20
- rowGap: { value: 32, unit: 'px' },
21
- columnGap: { value: 32, unit: 'px' },
22
- });
23
- });
24
- it('can parse a string with a float', () => {
25
- expect((0, StackUtils_1.parseGap)('20.5px', theme)).toEqual({
26
- rowGap: { value: 20.5, unit: 'px' },
27
- columnGap: { value: 20.5, unit: 'px' },
28
- });
29
- });
30
- it('parses the value from the theme when given a spacing key', () => {
31
- expect((0, StackUtils_1.parseGap)('m', theme)).toEqual({ rowGap: { value: 16, unit: 'em' }, columnGap: { value: 16, unit: 'em' } });
32
- });
33
- it('can parse a string with both horizontal and vertical gap', () => {
34
- expect((0, StackUtils_1.parseGap)('30px 10px', theme)).toEqual({
35
- rowGap: { value: 30, unit: 'px' },
36
- columnGap: { value: 10, unit: 'px' },
37
- });
38
- });
39
- it('defaults to px with a string with horizontal and vertical gap with no units', () => {
40
- expect((0, StackUtils_1.parseGap)('50 30', theme)).toEqual({
41
- rowGap: { value: 50, unit: 'px' },
42
- columnGap: { value: 30, unit: 'px' },
43
- });
44
- });
45
- it('can parse a string with horizontal and vertical gap with one of them getting value from the theme when given a spacing key', () => {
46
- expect((0, StackUtils_1.parseGap)('50px m', theme)).toEqual({
47
- rowGap: { value: 50, unit: 'px' },
48
- columnGap: { value: 16, unit: 'em' },
49
- });
50
- });
51
- });
52
- describe('parsePadding', () => {
53
- const theme = {
54
- spacing: {
55
- s2: '5px',
56
- s1: '10px',
57
- m: '15px',
58
- l1: '20px',
59
- l2: '25px',
60
- },
61
- };
62
- it('returns its argument when given undefined, a number, or an empty string', () => {
63
- expect((0, StackUtils_1.parsePadding)(undefined, theme)).toEqual(undefined);
64
- expect((0, StackUtils_1.parsePadding)(0, theme)).toEqual(0);
65
- });
66
- it('returns its argument when given a CSS-style padding', () => {
67
- expect((0, StackUtils_1.parsePadding)('10px', theme)).toEqual('10px');
68
- });
69
- it('converts themed spacing keys to CSS-style paddings', () => {
70
- expect((0, StackUtils_1.parsePadding)('s2', theme)).toEqual('5px');
71
- });
72
- });
73
55
  });
74
- //# sourceMappingURL=StackUtils.test.win32.js.map
56
+ //# sourceMappingURL=StackUtils.test.win32.js.map
@@ -1,2 +1,2 @@
1
1
  export {};
2
- //# sourceMappingURL=Stack.test.d.ts.map
2
+ //# sourceMappingURL=Stack.test.d.ts.map
@@ -1,76 +1,50 @@
1
- 'use strict';
2
- var __createBinding =
3
- (this && this.__createBinding) ||
4
- (Object.create
5
- ? function (o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
- desc = {
10
- enumerable: true,
11
- get: function () {
12
- return m[k];
13
- },
14
- };
15
- }
16
- Object.defineProperty(o, k2, desc);
17
- }
18
- : function (o, m, k, k2) {
19
- if (k2 === undefined) k2 = k;
20
- o[k2] = m[k];
21
- });
22
- var __setModuleDefault =
23
- (this && this.__setModuleDefault) ||
24
- (Object.create
25
- ? function (o, v) {
26
- Object.defineProperty(o, 'default', { enumerable: true, value: v });
27
- }
28
- : function (o, v) {
29
- o['default'] = v;
30
- });
31
- var __importStar =
32
- (this && this.__importStar) ||
33
- (function () {
34
- var ownKeys = function (o) {
35
- ownKeys =
36
- Object.getOwnPropertyNames ||
37
- function (o) {
38
- var ar = [];
39
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
40
- return ar;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
41
24
  };
42
- return ownKeys(o);
25
+ return ownKeys(o);
43
26
  };
44
27
  return function (mod) {
45
- if (mod && mod.__esModule) return mod;
46
- var result = {};
47
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== 'default') __createBinding(result, mod, k[i]);
48
- __setModuleDefault(result, mod);
49
- return result;
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
50
33
  };
51
- })();
52
- Object.defineProperty(exports, '__esModule', { value: true });
53
- const jsx_runtime_1 = require('react/jsx-runtime');
54
- const react_1 = require('react');
55
- const text_1 = require('@fluentui-react-native/text');
56
- const renderer = __importStar(require('react-test-renderer'));
57
- const __1 = require('..');
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const jsx_runtime_1 = require("react/jsx-runtime");
37
+ const react_1 = require("react");
38
+ const text_1 = require("@fluentui-react-native/text");
39
+ const renderer = __importStar(require("react-test-renderer"));
40
+ const __1 = require("..");
58
41
  it('Stack with tokens', () => {
59
- let component;
60
- (0, react_1.act)(() => {
61
- component = renderer.create(
62
- jsx_runtime_1.jsxs(__1.Stack, {
63
- maxWidth: 400,
64
- gap: 8,
65
- padding: 16,
66
- children: [
67
- jsx_runtime_1.jsx(text_1.Text, { children: 'Hello' }),
68
- jsx_runtime_1.jsx(text_1.Text, { children: 'Hello' }),
69
- jsx_runtime_1.jsx(text_1.Text, { children: 'Hello' }),
70
- ],
71
- }),
72
- );
73
- });
74
- expect(component.toJSON()).toMatchSnapshot();
42
+ let component;
43
+ (0, react_1.act)(() => {
44
+ component = renderer.create(jsx_runtime_1.jsxs(__1.Stack, { maxWidth: 400, gap: 8, padding: 16, children: [
45
+ jsx_runtime_1.jsx(text_1.Text, { children: "Hello" }), jsx_runtime_1.jsx(text_1.Text, { children: "Hello" }), jsx_runtime_1.jsx(text_1.Text, { children: "Hello" })
46
+ ] }));
47
+ });
48
+ expect(component.toJSON()).toMatchSnapshot();
75
49
  });
76
- //# sourceMappingURL=Stack.test.js.map
50
+ //# sourceMappingURL=Stack.test.js.map
@@ -4,4 +4,4 @@ export { StackItem } from './StackItem/StackItem';
4
4
  export { stackName } from './Stack.types';
5
5
  export type { Alignment, IStackProps, IStackRenderData, IStackSlotProps, IStackStatics, IStackTokens, IStackType } from './Stack.types';
6
6
  export { Stack } from './Stack';
7
- //# sourceMappingURL=index.d.ts.map
7
+ //# sourceMappingURL=index.d.ts.map
@@ -1,32 +1,12 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Stack = exports.stackName = exports.StackItem = exports.stackItemName = void 0;
4
- const StackItem_types_1 = require('./StackItem/StackItem.types');
5
- Object.defineProperty(exports, 'stackItemName', {
6
- enumerable: true,
7
- get: function () {
8
- return StackItem_types_1.stackItemName;
9
- },
10
- });
11
- const StackItem_1 = require('./StackItem/StackItem');
12
- Object.defineProperty(exports, 'StackItem', {
13
- enumerable: true,
14
- get: function () {
15
- return StackItem_1.StackItem;
16
- },
17
- });
18
- const Stack_types_1 = require('./Stack.types');
19
- Object.defineProperty(exports, 'stackName', {
20
- enumerable: true,
21
- get: function () {
22
- return Stack_types_1.stackName;
23
- },
24
- });
25
- const Stack_1 = require('./Stack');
26
- Object.defineProperty(exports, 'Stack', {
27
- enumerable: true,
28
- get: function () {
29
- return Stack_1.Stack;
30
- },
31
- });
32
- //# sourceMappingURL=index.js.map
4
+ const StackItem_types_1 = require("./StackItem/StackItem.types");
5
+ Object.defineProperty(exports, "stackItemName", { enumerable: true, get: function () { return StackItem_types_1.stackItemName; } });
6
+ const StackItem_1 = require("./StackItem/StackItem");
7
+ Object.defineProperty(exports, "StackItem", { enumerable: true, get: function () { return StackItem_1.StackItem; } });
8
+ const Stack_types_1 = require("./Stack.types");
9
+ Object.defineProperty(exports, "stackName", { enumerable: true, get: function () { return Stack_types_1.stackName; } });
10
+ const Stack_1 = require("./Stack");
11
+ Object.defineProperty(exports, "Stack", { enumerable: true, get: function () { return Stack_1.Stack; } });
12
+ //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,54 +1,55 @@
1
1
  {
2
2
  "name": "@fluentui-react-native/stack",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "A cross-platform opinionated Fluent Text component",
5
+ "license": "MIT",
6
+ "author": "",
5
7
  "repository": {
6
8
  "type": "git",
7
9
  "url": "https://github.com/microsoft/fluentui-react-native.git",
8
10
  "directory": "packages/components/Stack"
9
11
  },
10
- "license": "MIT",
11
- "author": "",
12
+ "main": "lib-commonjs/index.js",
13
+ "module": "lib/index.js",
14
+ "types": "lib/index.d.ts",
12
15
  "exports": {
13
16
  ".": {
14
17
  "types": "./lib/index.d.ts",
15
18
  "import": "./lib/index.js",
16
- "require": "./lib-commonjs/index.js"
19
+ "require": "./lib-commonjs/index.js",
20
+ "default": "./src/index.ts"
17
21
  }
18
22
  },
19
- "main": "lib-commonjs/index.js",
20
- "module": "lib/index.js",
21
- "types": "lib/index.d.ts",
22
23
  "scripts": {
23
24
  "build": "fluentui-scripts build",
24
25
  "build-cjs": "tsgo --outDir lib-commonjs",
25
- "build-esm": "tsgo --outDir lib --module esnext --moduleResolution bundler",
26
+ "build-core": "tsgo --outDir lib --module esnext --moduleResolution bundler",
26
27
  "clean": "fluentui-scripts clean",
27
28
  "depcheck": "fluentui-scripts depcheck",
28
29
  "lint": "fluentui-scripts eslint",
29
30
  "lint-package": "fluentui-scripts lint-package",
30
- "prettier": "fluentui-scripts prettier",
31
+ "format": "fluentui-scripts format",
31
32
  "test": "fluentui-scripts jest",
32
33
  "update-snapshots": "fluentui-scripts jest -u"
33
34
  },
34
35
  "dependencies": {
35
- "@fluentui-react-native/adapters": "0.14.0",
36
- "@fluentui-react-native/framework": "0.15.0",
37
- "@fluentui-react-native/tokens": "0.24.0",
38
- "@uifabricshared/foundation-composable": "0.14.0",
39
- "@uifabricshared/foundation-compose": "1.16.0",
40
- "@uifabricshared/foundation-settings": "0.16.0",
41
- "@uifabricshared/foundation-tokens": "0.16.0"
36
+ "@fluentui-react-native/adapters": "0.14.1",
37
+ "@fluentui-react-native/framework": "0.15.1",
38
+ "@fluentui-react-native/tokens": "0.24.1",
39
+ "@uifabricshared/foundation-composable": "0.14.1",
40
+ "@uifabricshared/foundation-compose": "1.16.1",
41
+ "@uifabricshared/foundation-settings": "0.16.1",
42
+ "@uifabricshared/foundation-tokens": "0.16.1"
42
43
  },
43
44
  "devDependencies": {
44
45
  "@babel/core": "^7.20.0",
45
46
  "@fluentui-react-native/babel-config": "0.1.1",
46
- "@fluentui-react-native/eslint-config-rules": "0.1.1",
47
- "@fluentui-react-native/framework-base": "0.3.0",
48
- "@fluentui-react-native/jest-config": "0.1.1",
47
+ "@fluentui-react-native/eslint-config-rules": "0.1.2",
48
+ "@fluentui-react-native/framework-base": "0.3.1",
49
+ "@fluentui-react-native/jest-config": "0.1.0",
49
50
  "@fluentui-react-native/kit-config": "0.1.2",
50
- "@fluentui-react-native/scripts": "0.1.2",
51
- "@fluentui-react-native/text": "0.25.0",
51
+ "@fluentui-react-native/scripts": "0.1.0",
52
+ "@fluentui-react-native/text": "0.25.1",
52
53
  "@react-native-community/cli": "^20.0.0",
53
54
  "@react-native-community/cli-platform-android": "^20.0.0",
54
55
  "@react-native-community/cli-platform-ios": "^20.0.0",