@cleartrip/ct-design-box 4.0.0-TEST.1 → 4.1.0-SNAPSHOT-native-main.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.
- package/README.md +75 -0
- package/dist/Box.d.ts +4 -5
- package/dist/Box.d.ts.map +1 -1
- package/dist/ct-design-box.browser.cjs.js +1 -1
- package/dist/ct-design-box.browser.cjs.js.map +1 -1
- package/dist/ct-design-box.browser.esm.js +1 -1
- package/dist/ct-design-box.browser.esm.js.map +1 -1
- package/dist/ct-design-box.cjs.js +32 -49
- package/dist/ct-design-box.cjs.js.map +1 -1
- package/dist/ct-design-box.esm.js +32 -45
- package/dist/ct-design-box.esm.js.map +1 -1
- package/dist/ct-design-box.umd.js +34 -89
- package/dist/ct-design-box.umd.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/style.d.ts +15 -4
- package/dist/style.d.ts.map +1 -1
- package/dist/type.d.ts +11 -5
- package/dist/type.d.ts.map +1 -1
- package/package.json +26 -11
- package/src/Box.tsx +36 -0
- package/src/index.ts +3 -0
- package/src/style.ts +43 -0
- package/src/type.ts +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Box
|
|
2
|
+
|
|
3
|
+
A flexible container component for layout and styling purposes.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @cleartrip/ct-design-box
|
|
11
|
+
# or
|
|
12
|
+
pnpm add @cleartrip/ct-design-box
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Peer dependencies
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Required for all targets
|
|
19
|
+
npm install react
|
|
20
|
+
|
|
21
|
+
# Web only
|
|
22
|
+
npm install react-dom
|
|
23
|
+
|
|
24
|
+
# React Native only
|
|
25
|
+
npm install react-native
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
### Basic
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { Box } from '@cleartrip/ct-design-box';
|
|
36
|
+
|
|
37
|
+
function Example() {
|
|
38
|
+
return (
|
|
39
|
+
<Box>
|
|
40
|
+
{/* Basic usage */}
|
|
41
|
+
</Box>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Props
|
|
49
|
+
|
|
50
|
+
| Prop | Type | Default | Required | Description |
|
|
51
|
+
|------|------|---------|----------|-------------|
|
|
52
|
+
| `children` | `ReactNode` | — | No | children property |
|
|
53
|
+
| `styleConfig` | `IBoxStyleConfig` | — | No | Style configuration overrides for the root container. |
|
|
54
|
+
| `onClick` | `() => void` | — | No | Fired when the root container is clicked/pressed. |
|
|
55
|
+
| `horizontal` | `boolean` | `false` | No | Lays the contents out horizontally. |
|
|
56
|
+
| `boxSize` | `BoxSize` | — | ✅ Yes | Sets the row or column gap between child elements. |
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Accessibility
|
|
61
|
+
|
|
62
|
+
- The component follows accessibility best practices
|
|
63
|
+
- Ensure proper ARIA attributes are provided where needed
|
|
64
|
+
- Test with screen readers to ensure usability
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Migration
|
|
69
|
+
|
|
70
|
+
If migrating from a previous version:
|
|
71
|
+
|
|
72
|
+
```diff
|
|
73
|
+
- import { Box } from 'yagami/core/components';
|
|
74
|
+
+ import { Box } from '@cleartrip/ct-design-box';
|
|
75
|
+
```
|
package/dist/Box.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
declare const Box: PolymorphicBox;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ContainerRef } from '@cleartrip/ct-design-container';
|
|
3
|
+
import { IBoxProps } from './type';
|
|
4
|
+
declare const Box: React.ForwardRefExoticComponent<IBoxProps & React.RefAttributes<ContainerRef>>;
|
|
6
5
|
export default Box;
|
|
7
6
|
//# sourceMappingURL=Box.d.ts.map
|
package/dist/Box.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../packages/components/Box/src/Box.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../packages/components/Box/src/Box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAa,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAGzE,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAGnC,QAAA,MAAM,GAAG,gFAwBR,CAAC;AAGF,eAAe,GAAG,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var r=require("react/jsx-runtime"),e=require("react"),o=require("@cleartrip/ct-design-container"),i=require("@cleartrip/ct-design-style-manager");const t=i.makeStyles(()=>({root:{display:"flex"}})),n={xLarge:10,big:8,medium:6,small:4,tiny:3,micro:2,nano:1,pico:1,zero:0};function l(r,e){var o,i;const t=null!==(o=n[e])&&void 0!==o?o:0;return null!==(i=r.spacing[t])&&void 0!==i?i:0}const c=e.forwardRef(({children:e,styleConfig:n,horizontal:c=!1,boxSize:a,onClick:s},u)=>{const{root:d=[]}=n||{},g=i.useStyles(r=>({root:{flexDirection:c?"row":"column",gap:l(r,a)}}),[c,a]);return r.jsx(o.Container,{ref:u,onClick:s,styleConfig:{root:[t.root,g.root,...d]},children:e})});c.displayName="Box",exports.Box=c;
|
|
2
2
|
//# sourceMappingURL=ct-design-box.browser.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-design-box.browser.cjs.js","sources":["../packages/components/Box/src/
|
|
1
|
+
{"version":3,"file":"ct-design-box.browser.cjs.js","sources":["../packages/components/Box/src/style.ts","../packages/components/Box/src/Box.tsx"],"sourcesContent":[null,null],"names":["boxStaticStyles","makeStyles","root","display","BOX_SIZE_SPACING_KEY","xLarge","big","medium","small","tiny","micro","nano","pico","zero","getBoxGap","theme","boxSize","spacingKey","_a","_b","spacing","Box","forwardRef","children","styleConfig","horizontal","onClick","forwardedRef","dynamicStyles","useStyles","flexDirection","gap","_jsx","jsx","Container","ref","staticStyles","displayName"],"mappings":"+JAWA,MAAMA,EAAkBC,EAAUA,WAAC,KAAO,CACxCC,KAAM,CACJC,QAAS,WAIPC,EAAgE,CACpEC,OAAQ,GACRC,IAAK,EACLC,OAAQ,EACRC,MAAO,EACPC,KAAM,EACNC,MAAO,EACPC,KAAM,EACNC,KAAM,EACNC,KAAM,GAGQ,SAAAC,EAAUC,EAAcC,WACtC,MAAMC,EAA8C,QAAjCC,EAAAd,EAAqBY,UAAY,IAAAE,EAAAA,EAAA,EACpD,OAAoC,QAA7BC,EAAAJ,EAAMK,QAAQH,UAAe,IAAAE,EAAAA,EAAA,CACtC,CCxBM,MAAAE,EAAMC,EAAUA,WACpB,EAAGC,WAAUC,cAAaC,cAAa,EAAOT,UAASU,WAAWC,KAChE,MAAMzB,KAAEA,EAAO,IAAOsB,GAAe,CAAA,EAE/BI,EAAgBC,YACnBd,IAAW,CACVb,KAAM,CACJ4B,cAAeL,EAAa,MAAQ,SACpCM,IAAKjB,EAAUC,EAAOC,MAG1B,CAACS,EAAYT,IAGf,OACEgB,EAAAC,IAACC,EAASA,UAAA,CACRC,IAAKR,EACLD,QAASA,EACTF,YAAa,CAAEtB,KAAM,CAACkC,EAAalC,KAAM0B,EAAc1B,QAASA,IAAOqB,SAEtEA,MAMTF,EAAIgB,YAAc"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import{forwardRef as r}from"react";import{Container as t}from"@cleartrip/ct-design-container";import{makeStyles as i,useStyles as n}from"@cleartrip/ct-design-style-manager";const e=i(()=>({root:{display:"flex"}})),c={xLarge:10,big:8,medium:6,small:4,tiny:3,micro:2,nano:1,pico:1,zero:0};function l(o,r){var t,i;const n=null!==(t=c[r])&&void 0!==t?t:0;return null!==(i=o.spacing[n])&&void 0!==i?i:0}const a=r(({children:r,styleConfig:i,horizontal:c=!1,boxSize:a,onClick:m},s)=>{const{root:p=[]}=i||{},f=n(o=>({root:{flexDirection:c?"row":"column",gap:l(o,a)}}),[c,a]);return o(t,{ref:s,onClick:m,styleConfig:{root:[e.root,f.root,...p]},children:r})});a.displayName="Box";export{a as Box};
|
|
2
2
|
//# sourceMappingURL=ct-design-box.browser.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-design-box.browser.esm.js","sources":["../packages/components/Box/src/style.ts","../packages/components/Box/src/Box.tsx"],"sourcesContent":[null,null],"names":["
|
|
1
|
+
{"version":3,"file":"ct-design-box.browser.esm.js","sources":["../packages/components/Box/src/style.ts","../packages/components/Box/src/Box.tsx"],"sourcesContent":[null,null],"names":["boxStaticStyles","makeStyles","root","display","BOX_SIZE_SPACING_KEY","xLarge","big","medium","small","tiny","micro","nano","pico","zero","getBoxGap","theme","boxSize","spacingKey","_a","_b","spacing","Box","forwardRef","children","styleConfig","horizontal","onClick","forwardedRef","dynamicStyles","useStyles","flexDirection","gap","_jsx","Container","ref","staticStyles","displayName"],"mappings":"qNAWA,MAAMA,EAAkBC,EAAW,KAAO,CACxCC,KAAM,CACJC,QAAS,WAIPC,EAAgE,CACpEC,OAAQ,GACRC,IAAK,EACLC,OAAQ,EACRC,MAAO,EACPC,KAAM,EACNC,MAAO,EACPC,KAAM,EACNC,KAAM,EACNC,KAAM,GAGQ,SAAAC,EAAUC,EAAcC,WACtC,MAAMC,EAA8C,QAAjCC,EAAAd,EAAqBY,UAAY,IAAAE,EAAAA,EAAA,EACpD,OAAoC,QAA7BC,EAAAJ,EAAMK,QAAQH,UAAe,IAAAE,EAAAA,EAAA,CACtC,CCxBM,MAAAE,EAAMC,EACV,EAAGC,WAAUC,cAAaC,cAAa,EAAOT,UAASU,WAAWC,KAChE,MAAMzB,KAAEA,EAAO,IAAOsB,GAAe,CAAA,EAE/BI,EAAgBC,EACnBd,IAAW,CACVb,KAAM,CACJ4B,cAAeL,EAAa,MAAQ,SACpCM,IAAKjB,EAAUC,EAAOC,MAG1B,CAACS,EAAYT,IAGf,OACEgB,EAACC,EAAS,CACRC,IAAKP,EACLD,QAASA,EACTF,YAAa,CAAEtB,KAAM,CAACiC,EAAajC,KAAM0B,EAAc1B,QAASA,IAAOqB,SAEtEA,MAMTF,EAAIe,YAAc"}
|
|
@@ -1,60 +1,43 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var tslib = require('tslib');
|
|
4
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
4
|
var react = require('react');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
5
|
+
var ctDesignContainer = require('@cleartrip/ct-design-container');
|
|
6
|
+
var ctDesignStyleManager = require('@cleartrip/ct-design-style-manager');
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
gap = 6;
|
|
25
|
-
break;
|
|
26
|
-
case 'small':
|
|
27
|
-
gap = 4;
|
|
28
|
-
break;
|
|
29
|
-
case 'tiny':
|
|
30
|
-
gap = 3;
|
|
31
|
-
break;
|
|
32
|
-
case 'micro':
|
|
33
|
-
gap = 2;
|
|
34
|
-
break;
|
|
35
|
-
case 'nano':
|
|
36
|
-
gap = 1;
|
|
37
|
-
break;
|
|
38
|
-
case 'pico':
|
|
39
|
-
gap = 1;
|
|
40
|
-
break;
|
|
41
|
-
case 'zero':
|
|
42
|
-
default:
|
|
43
|
-
gap = 0;
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
return tslib.__assign({ display: 'flex', gap: theme.spacing[gap] }, rest);
|
|
8
|
+
const boxStaticStyles = ctDesignStyleManager.makeStyles(() => ({
|
|
9
|
+
root: {
|
|
10
|
+
display: 'flex',
|
|
11
|
+
},
|
|
12
|
+
}));
|
|
13
|
+
const BOX_SIZE_SPACING_KEY = {
|
|
14
|
+
xLarge: 10,
|
|
15
|
+
big: 8,
|
|
16
|
+
medium: 6,
|
|
17
|
+
small: 4,
|
|
18
|
+
tiny: 3,
|
|
19
|
+
micro: 2,
|
|
20
|
+
nano: 1,
|
|
21
|
+
pico: 1,
|
|
22
|
+
zero: 0,
|
|
47
23
|
};
|
|
24
|
+
function getBoxGap(theme, boxSize) {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
const spacingKey = (_a = BOX_SIZE_SPACING_KEY[boxSize]) !== null && _a !== void 0 ? _a : 0;
|
|
27
|
+
return (_b = theme.spacing[spacingKey]) !== null && _b !== void 0 ? _b : 0;
|
|
28
|
+
}
|
|
48
29
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
30
|
+
const Box = react.forwardRef(({ children, styleConfig, horizontal = false, boxSize, onClick }, forwardedRef) => {
|
|
31
|
+
const { root = [] } = styleConfig || {};
|
|
32
|
+
const dynamicStyles = ctDesignStyleManager.useStyles((theme) => ({
|
|
33
|
+
root: {
|
|
34
|
+
flexDirection: horizontal ? 'row' : 'column',
|
|
35
|
+
gap: getBoxGap(theme, boxSize),
|
|
36
|
+
},
|
|
37
|
+
}), [horizontal, boxSize]);
|
|
38
|
+
return (jsxRuntime.jsx(ctDesignContainer.Container, { ref: forwardedRef, onClick: onClick, styleConfig: { root: [boxStaticStyles.root, dynamicStyles.root, ...root] }, children: children }));
|
|
57
39
|
});
|
|
40
|
+
Box.displayName = 'Box';
|
|
58
41
|
|
|
59
42
|
exports.Box = Box;
|
|
60
43
|
//# sourceMappingURL=ct-design-box.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-design-box.cjs.js","sources":["../packages/components/Box/src/style.ts","../packages/components/Box/src/Box.tsx"],"sourcesContent":[null,null],"names":["
|
|
1
|
+
{"version":3,"file":"ct-design-box.cjs.js","sources":["../packages/components/Box/src/style.ts","../packages/components/Box/src/Box.tsx"],"sourcesContent":[null,null],"names":["makeStyles","forwardRef","useStyles","_jsx","Container","staticStyles"],"mappings":";;;;;;;AAWA,MAAM,eAAe,GAAGA,+BAAU,CAAC,OAAO;AACxC,IAAA,IAAI,EAAE;AACJ,QAAA,OAAO,EAAE,MAAM;AAChB,KAAA;AACF,CAAA,CAAC,CAAC,CAAC;AAEJ,MAAM,oBAAoB,GAA4C;AACpE,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,GAAG,EAAE,CAAC;AACN,IAAA,MAAM,EAAE,CAAC;AACT,IAAA,KAAK,EAAE,CAAC;AACR,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,KAAK,EAAE,CAAC;AACR,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,IAAI,EAAE,CAAC;CACR,CAAC;AAEc,SAAA,SAAS,CAAC,KAAY,EAAE,OAAgB,EAAA;;IACtD,MAAM,UAAU,GAAG,CAAA,EAAA,GAAA,oBAAoB,CAAC,OAAO,CAAC,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,CAAC,CAAC;IACtD,OAAO,CAAA,EAAA,GAAA,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,CAAC,CAAC;AACxC;;ACxBM,MAAA,GAAG,GAAGC,gBAAU,CACpB,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,GAAG,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,YAAY,KAAI;IAChF,MAAM,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,WAAW,IAAI,EAAE,CAAC;IAExC,MAAM,aAAa,GAAGC,8BAAS,CAC7B,CAAC,KAAK,MAAM;AACV,QAAA,IAAI,EAAE;YACJ,aAAa,EAAE,UAAU,GAAG,KAAK,GAAG,QAAQ;AAC5C,YAAA,GAAG,EAAE,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC;AAC/B,SAAA;AACF,KAAA,CAAC,EACF,CAAC,UAAU,EAAE,OAAO,CAAC,CACtB,CAAC;AAEF,IAAA,QACEC,cAAA,CAACC,2BAAS,EAAA,EACR,GAAG,EAAE,YAAY,EACjB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,EAAE,IAAI,EAAE,CAACC,eAAY,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,EAAE,EAAA,QAAA,EAEtE,QAAQ,EAAA,CACC,EACZ;AACJ,CAAC,EACD;AAEF,GAAG,CAAC,WAAW,GAAG,KAAK;;;;"}
|
|
@@ -1,54 +1,41 @@
|
|
|
1
|
-
import { __rest, __assign } from 'tslib';
|
|
2
1
|
import { jsx } from 'react/jsx-runtime';
|
|
3
2
|
import { forwardRef } from 'react';
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
3
|
+
import { Container } from '@cleartrip/ct-design-container';
|
|
4
|
+
import { makeStyles, useStyles } from '@cleartrip/ct-design-style-manager';
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
break;
|
|
23
|
-
case 'tiny':
|
|
24
|
-
gap = 3;
|
|
25
|
-
break;
|
|
26
|
-
case 'micro':
|
|
27
|
-
gap = 2;
|
|
28
|
-
break;
|
|
29
|
-
case 'nano':
|
|
30
|
-
gap = 1;
|
|
31
|
-
break;
|
|
32
|
-
case 'pico':
|
|
33
|
-
gap = 1;
|
|
34
|
-
break;
|
|
35
|
-
case 'zero':
|
|
36
|
-
default:
|
|
37
|
-
gap = 0;
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
return __assign({ display: 'flex', gap: theme.spacing[gap] }, rest);
|
|
6
|
+
const boxStaticStyles = makeStyles(() => ({
|
|
7
|
+
root: {
|
|
8
|
+
display: 'flex',
|
|
9
|
+
},
|
|
10
|
+
}));
|
|
11
|
+
const BOX_SIZE_SPACING_KEY = {
|
|
12
|
+
xLarge: 10,
|
|
13
|
+
big: 8,
|
|
14
|
+
medium: 6,
|
|
15
|
+
small: 4,
|
|
16
|
+
tiny: 3,
|
|
17
|
+
micro: 2,
|
|
18
|
+
nano: 1,
|
|
19
|
+
pico: 1,
|
|
20
|
+
zero: 0,
|
|
41
21
|
};
|
|
22
|
+
function getBoxGap(theme, boxSize) {
|
|
23
|
+
var _a, _b;
|
|
24
|
+
const spacingKey = (_a = BOX_SIZE_SPACING_KEY[boxSize]) !== null && _a !== void 0 ? _a : 0;
|
|
25
|
+
return (_b = theme.spacing[spacingKey]) !== null && _b !== void 0 ? _b : 0;
|
|
26
|
+
}
|
|
42
27
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
28
|
+
const Box = forwardRef(({ children, styleConfig, horizontal = false, boxSize, onClick }, forwardedRef) => {
|
|
29
|
+
const { root = [] } = styleConfig || {};
|
|
30
|
+
const dynamicStyles = useStyles((theme) => ({
|
|
31
|
+
root: {
|
|
32
|
+
flexDirection: horizontal ? 'row' : 'column',
|
|
33
|
+
gap: getBoxGap(theme, boxSize),
|
|
34
|
+
},
|
|
35
|
+
}), [horizontal, boxSize]);
|
|
36
|
+
return (jsx(Container, { ref: forwardedRef, onClick: onClick, styleConfig: { root: [boxStaticStyles.root, dynamicStyles.root, ...root] }, children: children }));
|
|
51
37
|
});
|
|
38
|
+
Box.displayName = 'Box';
|
|
52
39
|
|
|
53
40
|
export { Box };
|
|
54
41
|
//# sourceMappingURL=ct-design-box.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-design-box.esm.js","sources":["../packages/components/Box/src/style.ts","../packages/components/Box/src/Box.tsx"],"sourcesContent":[null,null],"names":["_jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ct-design-box.esm.js","sources":["../packages/components/Box/src/style.ts","../packages/components/Box/src/Box.tsx"],"sourcesContent":[null,null],"names":["_jsx","staticStyles"],"mappings":";;;;;AAWA,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO;AACxC,IAAA,IAAI,EAAE;AACJ,QAAA,OAAO,EAAE,MAAM;AAChB,KAAA;AACF,CAAA,CAAC,CAAC,CAAC;AAEJ,MAAM,oBAAoB,GAA4C;AACpE,IAAA,MAAM,EAAE,EAAE;AACV,IAAA,GAAG,EAAE,CAAC;AACN,IAAA,MAAM,EAAE,CAAC;AACT,IAAA,KAAK,EAAE,CAAC;AACR,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,KAAK,EAAE,CAAC;AACR,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,IAAI,EAAE,CAAC;CACR,CAAC;AAEc,SAAA,SAAS,CAAC,KAAY,EAAE,OAAgB,EAAA;;IACtD,MAAM,UAAU,GAAG,CAAA,EAAA,GAAA,oBAAoB,CAAC,OAAO,CAAC,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,CAAC,CAAC;IACtD,OAAO,CAAA,EAAA,GAAA,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,CAAC,CAAC;AACxC;;ACxBM,MAAA,GAAG,GAAG,UAAU,CACpB,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,GAAG,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,YAAY,KAAI;IAChF,MAAM,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,WAAW,IAAI,EAAE,CAAC;IAExC,MAAM,aAAa,GAAG,SAAS,CAC7B,CAAC,KAAK,MAAM;AACV,QAAA,IAAI,EAAE;YACJ,aAAa,EAAE,UAAU,GAAG,KAAK,GAAG,QAAQ;AAC5C,YAAA,GAAG,EAAE,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC;AAC/B,SAAA;AACF,KAAA,CAAC,EACF,CAAC,UAAU,EAAE,OAAO,CAAC,CACtB,CAAC;AAEF,IAAA,QACEA,GAAA,CAAC,SAAS,EAAA,EACR,GAAG,EAAE,YAAY,EACjB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,EAAE,IAAI,EAAE,CAACC,eAAY,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,EAAE,EAAA,QAAA,EAEtE,QAAQ,EAAA,CACC,EACZ;AACJ,CAAC,EACD;AAEF,GAAG,CAAC,WAAW,GAAG,KAAK;;;;"}
|
|
@@ -1,97 +1,42 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('react'), require('@
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', 'react', '@
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CTDesignSystemBox = {}, global.jsxRuntime, global.React, global.
|
|
5
|
-
})(this, (function (exports, jsxRuntime, react,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
23
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
24
|
-
***************************************************************************** */
|
|
25
|
-
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
26
|
-
|
|
27
|
-
var __assign = function () {
|
|
28
|
-
__assign = Object.assign || function __assign(t) {
|
|
29
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
30
|
-
s = arguments[i];
|
|
31
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
32
|
-
}
|
|
33
|
-
return t;
|
|
34
|
-
};
|
|
35
|
-
return __assign.apply(this, arguments);
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react/jsx-runtime'), require('react'), require('@cleartrip/ct-design-container'), require('@cleartrip/ct-design-style-manager')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react/jsx-runtime', 'react', '@cleartrip/ct-design-container', '@cleartrip/ct-design-style-manager'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.CTDesignSystemBox = {}, global.jsxRuntime, global.React, global.ctDesignContainer, global.ctDesignStyleManager));
|
|
5
|
+
})(this, (function (exports, jsxRuntime, react, ctDesignContainer, ctDesignStyleManager) { 'use strict';
|
|
6
|
+
|
|
7
|
+
const boxStaticStyles = ctDesignStyleManager.makeStyles(() => ({
|
|
8
|
+
root: {
|
|
9
|
+
display: 'flex',
|
|
10
|
+
},
|
|
11
|
+
}));
|
|
12
|
+
const BOX_SIZE_SPACING_KEY = {
|
|
13
|
+
xLarge: 10,
|
|
14
|
+
big: 8,
|
|
15
|
+
medium: 6,
|
|
16
|
+
small: 4,
|
|
17
|
+
tiny: 3,
|
|
18
|
+
micro: 2,
|
|
19
|
+
nano: 1,
|
|
20
|
+
pico: 1,
|
|
21
|
+
zero: 0,
|
|
36
22
|
};
|
|
37
|
-
function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
42
|
-
}
|
|
43
|
-
return t;
|
|
23
|
+
function getBoxGap(theme, boxSize) {
|
|
24
|
+
var _a, _b;
|
|
25
|
+
const spacingKey = (_a = BOX_SIZE_SPACING_KEY[boxSize]) !== null && _a !== void 0 ? _a : 0;
|
|
26
|
+
return (_b = theme.spacing[spacingKey]) !== null && _b !== void 0 ? _b : 0;
|
|
44
27
|
}
|
|
45
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
46
|
-
var e = new Error(message);
|
|
47
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
var getBoxStyles = function (_a) {
|
|
51
|
-
var boxSize = _a.boxSize, theme = _a.theme, rest = __rest(_a, ["boxSize", "theme"]);
|
|
52
|
-
var gap;
|
|
53
|
-
switch (boxSize) {
|
|
54
|
-
case 'xLarge':
|
|
55
|
-
gap = 10;
|
|
56
|
-
break;
|
|
57
|
-
case 'big':
|
|
58
|
-
gap = 8;
|
|
59
|
-
break;
|
|
60
|
-
case 'medium':
|
|
61
|
-
gap = 6;
|
|
62
|
-
break;
|
|
63
|
-
case 'small':
|
|
64
|
-
gap = 4;
|
|
65
|
-
break;
|
|
66
|
-
case 'tiny':
|
|
67
|
-
gap = 3;
|
|
68
|
-
break;
|
|
69
|
-
case 'micro':
|
|
70
|
-
gap = 2;
|
|
71
|
-
break;
|
|
72
|
-
case 'nano':
|
|
73
|
-
gap = 1;
|
|
74
|
-
break;
|
|
75
|
-
case 'pico':
|
|
76
|
-
gap = 1;
|
|
77
|
-
break;
|
|
78
|
-
case 'zero':
|
|
79
|
-
default:
|
|
80
|
-
gap = 0;
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
return __assign({ display: 'flex', gap: theme.spacing[gap] }, rest);
|
|
84
|
-
};
|
|
85
28
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
29
|
+
const Box = react.forwardRef(({ children, styleConfig, horizontal = false, boxSize, onClick }, forwardedRef) => {
|
|
30
|
+
const { root = [] } = styleConfig || {};
|
|
31
|
+
const dynamicStyles = ctDesignStyleManager.useStyles((theme) => ({
|
|
32
|
+
root: {
|
|
33
|
+
flexDirection: horizontal ? 'row' : 'column',
|
|
34
|
+
gap: getBoxGap(theme, boxSize),
|
|
35
|
+
},
|
|
36
|
+
}), [horizontal, boxSize]);
|
|
37
|
+
return (jsxRuntime.jsx(ctDesignContainer.Container, { ref: forwardedRef, onClick: onClick, styleConfig: { root: [boxStaticStyles.root, dynamicStyles.root, ...root] }, children: children }));
|
|
94
38
|
});
|
|
39
|
+
Box.displayName = 'Box';
|
|
95
40
|
|
|
96
41
|
exports.Box = Box;
|
|
97
42
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-design-box.umd.js","sources":["../../../../node_modules/.pnpm/@rollup+plugin-typescript@9.0.2_rollup@3.29.5_tslib@2.8.1_typescript@4.9.5/node_modules/tslib/tslib.es6.js","../packages/components/Box/src/style.ts","../packages/components/Box/src/Box.tsx"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n};\r\n\r\nexport function __runInitializers(thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n};\r\n\r\nexport function __propKey(x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n};\r\n\r\nexport function __setFunctionName(f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n};\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nvar ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n\r\nexport function __addDisposableResource(env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n\r\n}\r\n\r\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\r\n\r\nexport function __disposeResources(env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n}\r\n\r\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n}\r\n\r\nexport default {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __createBinding: __createBinding,\r\n __exportStar: __exportStar,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n};\r\n",null,null],"names":["__assign","Object","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","__rest","e","indexOf","getOwnPropertySymbols","propertyIsEnumerable","SuppressedError","error","suppressed","message","Error","name","styled","forwardRef","useTheme","_jsx"],"mappings":"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","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"ct-design-box.umd.js","sources":["../packages/components/Box/src/style.ts","../packages/components/Box/src/Box.tsx"],"sourcesContent":[null,null],"names":["makeStyles","forwardRef","useStyles","_jsx","Container","staticStyles"],"mappings":";;;;;;IAWA,MAAM,eAAe,GAAGA,+BAAU,CAAC,OAAO;IACxC,IAAA,IAAI,EAAE;IACJ,QAAA,OAAO,EAAE,MAAM;IAChB,KAAA;IACF,CAAA,CAAC,CAAC,CAAC;IAEJ,MAAM,oBAAoB,GAA4C;IACpE,IAAA,MAAM,EAAE,EAAE;IACV,IAAA,GAAG,EAAE,CAAC;IACN,IAAA,MAAM,EAAE,CAAC;IACT,IAAA,KAAK,EAAE,CAAC;IACR,IAAA,IAAI,EAAE,CAAC;IACP,IAAA,KAAK,EAAE,CAAC;IACR,IAAA,IAAI,EAAE,CAAC;IACP,IAAA,IAAI,EAAE,CAAC;IACP,IAAA,IAAI,EAAE,CAAC;KACR,CAAC;IAEc,SAAA,SAAS,CAAC,KAAY,EAAE,OAAgB,EAAA;;QACtD,MAAM,UAAU,GAAG,CAAA,EAAA,GAAA,oBAAoB,CAAC,OAAO,CAAC,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,CAAC,CAAC;QACtD,OAAO,CAAA,EAAA,GAAA,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,CAAC,CAAC;IACxC;;ACxBM,UAAA,GAAG,GAAGC,gBAAU,CACpB,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,GAAG,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,YAAY,KAAI;QAChF,MAAM,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,WAAW,IAAI,EAAE,CAAC;QAExC,MAAM,aAAa,GAAGC,8BAAS,CAC7B,CAAC,KAAK,MAAM;IACV,QAAA,IAAI,EAAE;gBACJ,aAAa,EAAE,UAAU,GAAG,KAAK,GAAG,QAAQ;IAC5C,YAAA,GAAG,EAAE,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC;IAC/B,SAAA;IACF,KAAA,CAAC,EACF,CAAC,UAAU,EAAE,OAAO,CAAC,CACtB,CAAC;IAEF,IAAA,QACEC,cAAA,CAACC,2BAAS,EAAA,EACR,GAAG,EAAE,YAAY,EACjB,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,EAAE,IAAI,EAAE,CAACC,eAAY,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,EAAE,EAAA,QAAA,EAEtE,QAAQ,EAAA,CACC,EACZ;IACJ,CAAC,EACD;IAEF,GAAG,CAAC,WAAW,GAAG,KAAK;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../packages/components/Box/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,OAAO,CAAC;AAEvC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../packages/components/Box/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,OAAO,CAAC;AAEvC,mBAAmB,QAAQ,CAAC"}
|
package/dist/style.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { Theme } from '@cleartrip/ct-design-theme';
|
|
2
|
+
import { BoxSize } from './type';
|
|
3
|
+
declare const boxStaticStyles: {
|
|
4
|
+
root: {
|
|
5
|
+
display: "flex";
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
export declare function getBoxGap(theme: Theme, boxSize: BoxSize): number;
|
|
9
|
+
export declare function getBoxStyles({ boxSize, theme }: {
|
|
10
|
+
boxSize: BoxSize;
|
|
11
|
+
theme: Theme;
|
|
12
|
+
}): {
|
|
13
|
+
gap: number;
|
|
14
|
+
};
|
|
15
|
+
export default boxStaticStyles;
|
|
5
16
|
//# sourceMappingURL=style.d.ts.map
|
package/dist/style.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../packages/components/Box/src/style.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../packages/components/Box/src/style.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAQjC,QAAA,MAAM,eAAe;;;;CAIlB,CAAC;AAcJ,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAGhE;AAMD,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE;;EAElF;AAED,eAAe,eAAe,CAAC"}
|
package/dist/type.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { Styles } from '@cleartrip/ct-design-types';
|
|
2
3
|
export type BoxSize = 'xLarge' | 'big' | 'medium' | 'small' | 'tiny' | 'micro' | 'nano' | 'pico' | 'zero';
|
|
3
|
-
export
|
|
4
|
+
export interface IBoxStyleConfig {
|
|
5
|
+
root?: Styles[];
|
|
6
|
+
}
|
|
7
|
+
export interface IBoxProps {
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
styleConfig?: IBoxStyleConfig;
|
|
10
|
+
onClick?: () => void;
|
|
4
11
|
horizontal?: boolean;
|
|
5
12
|
boxSize: BoxSize;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} & T;
|
|
13
|
+
}
|
|
14
|
+
export type BoxProps<T = Record<string, unknown>> = IBoxProps & T;
|
|
9
15
|
//# sourceMappingURL=type.d.ts.map
|
package/dist/type.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../packages/components/Box/src/type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../packages/components/Box/src/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEzD,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAE1G,MAAM,WAAW,eAAe;IAI9B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAC;IAIrB,WAAW,CAAC,EAAE,eAAe,CAAC;IAI9B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAKrB,UAAU,CAAC,EAAE,OAAO,CAAC;IAIrB,OAAO,EAAE,OAAO,CAAC;CAClB;AAMD,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,SAAS,GAAG,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,32 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleartrip/ct-design-box",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0-SNAPSHOT-native-main.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
|
-
"main": "dist/ct-design-box.cjs.js",
|
|
6
|
+
"main": "./dist/ct-design-box.cjs.js",
|
|
7
|
+
"react-native": "src/index.ts",
|
|
7
8
|
"jsnext:main": "dist/ct-design-box.esm.js",
|
|
8
9
|
"module": "dist/ct-design-box.esm.js",
|
|
9
10
|
"sideEffects": false,
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/ct-design-box.esm.js",
|
|
15
|
+
"default": "./dist/ct-design-box.cjs.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
10
18
|
"browser": {
|
|
11
19
|
"./dist/ct-design-box.esm.js": "./dist/ct-design-box.browser.esm.js",
|
|
12
20
|
"./dist/ct-design-box.cjs.js": "./dist/ct-design-box.browser.cjs.js"
|
|
13
21
|
},
|
|
14
22
|
"files": [
|
|
15
|
-
"dist"
|
|
23
|
+
"dist",
|
|
24
|
+
"src"
|
|
16
25
|
],
|
|
17
26
|
"dependencies": {
|
|
18
|
-
"@
|
|
19
|
-
"@
|
|
20
|
-
"@cleartrip/ct-design-
|
|
21
|
-
"@cleartrip/ct-design-theme": "4.0.0-TEST.1"
|
|
27
|
+
"@cleartrip/ct-design-container": "4.1.0-SNAPSHOT-native-main.1",
|
|
28
|
+
"@cleartrip/ct-design-style-manager": "4.0.0-SNAPSHOT-native-main.12",
|
|
29
|
+
"@cleartrip/ct-design-theme": "4.0.0-SNAPSHOT-native-main.12"
|
|
22
30
|
},
|
|
23
31
|
"devDependencies": {
|
|
24
|
-
"@
|
|
25
|
-
"@cleartrip/ct-design-types": "4.0.0-TEST.1"
|
|
32
|
+
"@cleartrip/ct-design-types": "4.0.0-SNAPSHOT-native-main.12"
|
|
26
33
|
},
|
|
27
34
|
"peerDependencies": {
|
|
28
35
|
"react": ">=16.8.0",
|
|
29
|
-
"react-dom": ">=16.8.0"
|
|
36
|
+
"react-dom": ">=16.8.0",
|
|
37
|
+
"react-native": ">=0.68.0"
|
|
38
|
+
},
|
|
39
|
+
"peerDependenciesMeta": {
|
|
40
|
+
"react-native": {
|
|
41
|
+
"optional": true
|
|
42
|
+
}
|
|
30
43
|
},
|
|
31
44
|
"publishConfig": {
|
|
32
45
|
"access": "public"
|
|
@@ -37,6 +50,8 @@
|
|
|
37
50
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
38
51
|
"watch-package": "rollup -c -w",
|
|
39
52
|
"build-package": "rollup -c",
|
|
40
|
-
"build-package:clean": "rm -rf dist && rollup -c"
|
|
53
|
+
"build-package:clean": "rm -rf dist && rollup -c",
|
|
54
|
+
"publish-package:local": "yalc publish --no-scripts",
|
|
55
|
+
"publish-package:local:registry": "pnpm publish --registry http://localhost:4873 --no-git-checks --access public"
|
|
41
56
|
}
|
|
42
57
|
}
|
package/src/Box.tsx
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Container, ContainerRef } from '@cleartrip/ct-design-container';
|
|
4
|
+
import { useStyles } from '@cleartrip/ct-design-style-manager';
|
|
5
|
+
|
|
6
|
+
import { IBoxProps } from './type';
|
|
7
|
+
import staticStyles, { getBoxGap } from './style';
|
|
8
|
+
|
|
9
|
+
const Box = forwardRef<ContainerRef, IBoxProps>(
|
|
10
|
+
({ children, styleConfig, horizontal = false, boxSize, onClick }, forwardedRef) => {
|
|
11
|
+
const { root = [] } = styleConfig || {};
|
|
12
|
+
|
|
13
|
+
const dynamicStyles = useStyles(
|
|
14
|
+
(theme) => ({
|
|
15
|
+
root: {
|
|
16
|
+
flexDirection: horizontal ? 'row' : 'column',
|
|
17
|
+
gap: getBoxGap(theme, boxSize),
|
|
18
|
+
},
|
|
19
|
+
}),
|
|
20
|
+
[horizontal, boxSize],
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Container
|
|
25
|
+
ref={forwardedRef}
|
|
26
|
+
onClick={onClick}
|
|
27
|
+
styleConfig={{ root: [staticStyles.root, dynamicStyles.root, ...root] }}
|
|
28
|
+
>
|
|
29
|
+
{children}
|
|
30
|
+
</Container>
|
|
31
|
+
);
|
|
32
|
+
},
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
Box.displayName = 'Box';
|
|
36
|
+
export default Box;
|
package/src/index.ts
ADDED
package/src/style.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { makeStyles } from '@cleartrip/ct-design-style-manager';
|
|
2
|
+
import type { Theme } from '@cleartrip/ct-design-theme';
|
|
3
|
+
|
|
4
|
+
import { BoxSize } from './type';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Static, platform-agnostic layout styles for Box.
|
|
8
|
+
*
|
|
9
|
+
* The variant-dependent `gap` + `flexDirection` are merged at render time
|
|
10
|
+
* via `useStyles`.
|
|
11
|
+
*/
|
|
12
|
+
const boxStaticStyles = makeStyles(() => ({
|
|
13
|
+
root: {
|
|
14
|
+
display: 'flex',
|
|
15
|
+
},
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
const BOX_SIZE_SPACING_KEY: Record<BoxSize, keyof Theme['spacing']> = {
|
|
19
|
+
xLarge: 10,
|
|
20
|
+
big: 8,
|
|
21
|
+
medium: 6,
|
|
22
|
+
small: 4,
|
|
23
|
+
tiny: 3,
|
|
24
|
+
micro: 2,
|
|
25
|
+
nano: 1,
|
|
26
|
+
pico: 1,
|
|
27
|
+
zero: 0,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export function getBoxGap(theme: Theme, boxSize: BoxSize): number {
|
|
31
|
+
const spacingKey = BOX_SIZE_SPACING_KEY[boxSize] ?? 0;
|
|
32
|
+
return theme.spacing[spacingKey] ?? 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated Retained for any callers still using the old helper. Prefer
|
|
37
|
+
* `getBoxGap` with the new Container-based composition.
|
|
38
|
+
*/
|
|
39
|
+
export function getBoxStyles({ boxSize, theme }: { boxSize: BoxSize; theme: Theme }) {
|
|
40
|
+
return { gap: getBoxGap(theme, boxSize) };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default boxStaticStyles;
|
package/src/type.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { Styles } from '@cleartrip/ct-design-types';
|
|
4
|
+
|
|
5
|
+
export type BoxSize = 'xLarge' | 'big' | 'medium' | 'small' | 'tiny' | 'micro' | 'nano' | 'pico' | 'zero';
|
|
6
|
+
|
|
7
|
+
export interface IBoxStyleConfig {
|
|
8
|
+
/**
|
|
9
|
+
* Styles for the root container of the box.
|
|
10
|
+
*/
|
|
11
|
+
root?: Styles[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface IBoxProps {
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
/**
|
|
17
|
+
* Style configuration overrides for the root container.
|
|
18
|
+
*/
|
|
19
|
+
styleConfig?: IBoxStyleConfig;
|
|
20
|
+
/**
|
|
21
|
+
* Fired when the root container is clicked/pressed.
|
|
22
|
+
*/
|
|
23
|
+
onClick?: () => void;
|
|
24
|
+
/**
|
|
25
|
+
* Lays the contents out horizontally.
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
horizontal?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Sets the row or column gap between child elements.
|
|
31
|
+
*/
|
|
32
|
+
boxSize: BoxSize;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated Kept for backward compatibility with the previous emotion-styled
|
|
37
|
+
* implementation; use `IBoxProps` going forward.
|
|
38
|
+
*/
|
|
39
|
+
export type BoxProps<T = Record<string, unknown>> = IBoxProps & T;
|