webadwaita 0.2.0 → 0.2.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 +25 -32
- package/dist/native/Box/index.js +120 -0
- package/{src/Button/index.tsx → dist/native/Button/index.js} +32 -50
- package/{src/Card/index.tsx → dist/native/Card/index.js} +25 -25
- package/{src/Checkbox/index.tsx → dist/native/Checkbox/index.js} +41 -48
- package/{src/Entry/index.tsx → dist/native/Entry/index.js} +24 -42
- package/{src/HeaderBar/index.tsx → dist/native/HeaderBar/index.js} +31 -30
- package/{src/Switch/index.tsx → dist/native/Switch/index.js} +31 -37
- package/dist/native/index.js +8 -0
- package/{src/theme.ts → dist/native/theme.js} +4 -7
- package/{src/tokens.css.ts → dist/native/tokens.css.js} +3 -17
- package/dist/types/Box/index.d.ts +23 -0
- package/dist/types/Box/index.d.ts.map +1 -0
- package/dist/types/Button/index.d.ts +22 -0
- package/dist/types/Button/index.d.ts.map +1 -0
- package/dist/types/Card/index.d.ts +14 -0
- package/dist/types/Card/index.d.ts.map +1 -0
- package/dist/types/Checkbox/index.d.ts +13 -0
- package/dist/types/Checkbox/index.d.ts.map +1 -0
- package/dist/types/Entry/index.d.ts +17 -0
- package/dist/types/Entry/index.d.ts.map +1 -0
- package/dist/types/HeaderBar/index.d.ts +16 -0
- package/dist/types/HeaderBar/index.d.ts.map +1 -0
- package/dist/types/Switch/index.d.ts +13 -0
- package/dist/types/Switch/index.d.ts.map +1 -0
- package/{src/index.ts → dist/types/index.d.ts} +1 -7
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/theme.d.ts +77 -0
- package/dist/types/theme.d.ts.map +1 -0
- package/dist/types/tokens.css.d.ts +76 -0
- package/dist/types/tokens.css.d.ts.map +1 -0
- package/dist/web/Box/index.js +150 -0
- package/dist/web/Box/styles.css +39 -0
- package/dist/web/Button/index.js +132 -0
- package/dist/web/Button/styles.css +81 -0
- package/dist/web/Card/index.js +75 -0
- package/dist/web/Card/styles.css +91 -0
- package/dist/web/Checkbox/index.js +116 -0
- package/dist/web/Checkbox/styles.css +99 -0
- package/dist/web/Entry/index.js +74 -0
- package/dist/web/Entry/styles.css +113 -0
- package/dist/web/HeaderBar/index.js +87 -0
- package/dist/web/HeaderBar/styles.css +117 -0
- package/dist/web/Switch/index.js +86 -0
- package/dist/web/Switch/styles.css +134 -0
- package/dist/web/_tokens/styles.css +32 -0
- package/dist/web/index.js +8 -0
- package/dist/web/theme.js +16 -0
- package/dist/web/tokens.css.js +79 -0
- package/package.json +28 -9
- package/babel.config.cjs +0 -23
- package/src/Box/index.tsx +0 -105
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
|
|
2
|
+
@layer priority1, priority2, priority3, priority4;
|
|
3
|
+
@layer priority1{
|
|
4
|
+
.x1rfi6cy{padding:12px}
|
|
5
|
+
.xwmi1nh{padding:16px}
|
|
6
|
+
.x14yi81o{padding:24px}
|
|
7
|
+
.x1ck75x5{padding:32px}
|
|
8
|
+
.xudt4gt{padding:4px}
|
|
9
|
+
.x12ldruc{padding:8px}
|
|
10
|
+
}
|
|
11
|
+
@layer priority2{
|
|
12
|
+
.x1bbxysd{border-color:rgba(0, 0, 0, 0.15)}
|
|
13
|
+
.x16xecvt{border-color:rgba(0, 0, 0, 0.25)}
|
|
14
|
+
.x1ctf4ec{border-radius:11px}
|
|
15
|
+
.x3wdnbj{border-radius:12px}
|
|
16
|
+
.xixl9f9{border-radius:14px}
|
|
17
|
+
.xdwrzdg{border-radius:6px}
|
|
18
|
+
.x4gkjtx{border-radius:9999px}
|
|
19
|
+
.xdamf1x{border-radius:9px}
|
|
20
|
+
.x19u8g8r{gap:12px}
|
|
21
|
+
.x1od9ebw{gap:16px}
|
|
22
|
+
.xc9i02s{gap:24px}
|
|
23
|
+
.xy744dg{gap:32px}
|
|
24
|
+
.x1cuygh6{gap:4px}
|
|
25
|
+
.x15hg9oy{gap:8px}
|
|
26
|
+
.xb3r6kr{overflow:hidden}
|
|
27
|
+
.x83n5x6{padding-block:12px}
|
|
28
|
+
.x5f28bg{padding-block:8px}
|
|
29
|
+
.x1of5wme{padding-inline:12px}
|
|
30
|
+
.x1w4cf6q{padding-inline:16px}
|
|
31
|
+
.xoawizh{padding-inline:24px}
|
|
32
|
+
.x1pe04oy:hover{border-color:rgba(0, 0, 0, 0.8)}
|
|
33
|
+
}
|
|
34
|
+
@layer priority3{
|
|
35
|
+
.x1pha0wt{align-items:baseline}
|
|
36
|
+
.x6s0dn4{align-items:center}
|
|
37
|
+
.xuk3077{align-items:flex-end}
|
|
38
|
+
.x1cy8zhl{align-items:flex-start}
|
|
39
|
+
.x1qjc9v5{align-items:stretch}
|
|
40
|
+
.xqcrz7y{align-self:flex-start}
|
|
41
|
+
.xkh2ocl{align-self:stretch}
|
|
42
|
+
.xhw1y8f{background-color:#3584e4}
|
|
43
|
+
.x1jedtje{background-color:#e01b24}
|
|
44
|
+
.xdwvxq8{background-color:#ebebeb}
|
|
45
|
+
.x2pwvcl{background-color:#ffffff}
|
|
46
|
+
.x1c5tqo3{background-color:#ffffff}
|
|
47
|
+
.x1wvpxmy{background-color:rgba(0, 0, 0, 0.07)}
|
|
48
|
+
.xjbqb8w{background-color:transparent}
|
|
49
|
+
.x6zc1lr{background-color:rgba(0, 0, 0, 0.12)}
|
|
50
|
+
.xbo08cl{box-shadow:0 1px 2px rgba(0,0,0,.25)}
|
|
51
|
+
.x11j0q79{box-shadow:0 1px 3px rgba(0,0,0,.06),0 1px 2px rgba(0,0,0,.04)}
|
|
52
|
+
.xgtzv0a{color:#ffffff}
|
|
53
|
+
.xk7gp71{color:#ffffff}
|
|
54
|
+
.xlw9qwm{color:rgba(0, 0, 0, 0.55)}
|
|
55
|
+
.x117bw84{color:rgba(0, 0, 0, 0.8)}
|
|
56
|
+
.x1h6gzvc{cursor:not-allowed}
|
|
57
|
+
.x1ypdohk{cursor:pointer}
|
|
58
|
+
.x78zum5{display:flex}
|
|
59
|
+
.x1r8uery{flex-basis:0}
|
|
60
|
+
.xdt5ytf{flex-direction:column}
|
|
61
|
+
.x1q0g3np{flex-direction:row}
|
|
62
|
+
.x1iyjqo2{flex-grow:1}
|
|
63
|
+
.x1a02dak{flex-wrap:wrap}
|
|
64
|
+
.x164ifzn{font-family:"Adwaita Sans", "Cantarell", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif}
|
|
65
|
+
.x13gn23q{font-size:12px}
|
|
66
|
+
.xqwltnl{font-size:14px}
|
|
67
|
+
.xif65rj{font-size:14px}
|
|
68
|
+
.x1lbyq2x{font-size:16px}
|
|
69
|
+
.xaajq3h{font-weight:600}
|
|
70
|
+
.xq8utqp{font-weight:700}
|
|
71
|
+
.x1xlr1w8{font-weight:700}
|
|
72
|
+
.xl56j7k{justify-content:center}
|
|
73
|
+
.x13a6bvl{justify-content:flex-end}
|
|
74
|
+
.x1nhvcw1{justify-content:flex-start}
|
|
75
|
+
.x1l1ennw{justify-content:space-around}
|
|
76
|
+
.x1qughib{justify-content:space-between}
|
|
77
|
+
.xaw8158{justify-content:space-evenly}
|
|
78
|
+
.x11807lh{line-height:1.3}
|
|
79
|
+
.x1aebrpu{line-height:1.4}
|
|
80
|
+
.x7zvn91{line-height:1.5}
|
|
81
|
+
.xo5v014{line-height:1}
|
|
82
|
+
.xbyyjgo{opacity:.5}
|
|
83
|
+
.x10l6tqk{position:absolute}
|
|
84
|
+
.x1n2onr6{position:relative}
|
|
85
|
+
.x2b8uid{text-align:center}
|
|
86
|
+
.xcj3dzi{transition-duration:120ms}
|
|
87
|
+
.x176dcb3{transition-duration:180ms}
|
|
88
|
+
.xts7igz{transition-property:background-color,border-color}
|
|
89
|
+
.x1koyr57{transition-property:background-color,box-shadow,color}
|
|
90
|
+
.x15406qy{transition-property:background-color}
|
|
91
|
+
.xq90yva{transition-property:border-color,background-color}
|
|
92
|
+
.x1ebn093{transition-property:left,transform}
|
|
93
|
+
.xfrgxy7{transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}
|
|
94
|
+
.x87ps6o{user-select:none}
|
|
95
|
+
.x12s1yt6:hover{background-color:#4a90e9}
|
|
96
|
+
.xusvk13:hover{background-color:#e8434b}
|
|
97
|
+
.x1b2b8i4:hover{background-color:rgba(0, 0, 0, 0.07)}
|
|
98
|
+
.xvuosku:hover{background-color:rgba(0, 0, 0, 0.12)}
|
|
99
|
+
.xnh8i4f:hover{background-color:rgba(0, 0, 0, 0.18)}
|
|
100
|
+
.xc7rq14:active{background-color:#1a6bb8}
|
|
101
|
+
.x1x0tut:active{background-color:#b81920}
|
|
102
|
+
.x1krbwd3:active{background-color:rgba(0, 0, 0, 0.12)}
|
|
103
|
+
.xtkh9g1:active{background-color:rgba(0, 0, 0, 0.18)}
|
|
104
|
+
}
|
|
105
|
+
@layer priority4{
|
|
106
|
+
.x16l2oou{border-bottom-color:#e01b24}
|
|
107
|
+
.x14ro01c{border-bottom-color:rgba(0, 0, 0, 0.15)}
|
|
108
|
+
.x16stqrj{border-bottom-color:transparent}
|
|
109
|
+
.xfrllxf{border-bottom-left-radius:0}
|
|
110
|
+
.xjppbhk{border-bottom-right-radius:0}
|
|
111
|
+
.x1q0q8m5{border-bottom-style:solid}
|
|
112
|
+
.xso031l{border-bottom-width:1px}
|
|
113
|
+
.xlxy82{border-bottom-width:2px}
|
|
114
|
+
.x2donmn{border-top-left-radius:6px}
|
|
115
|
+
.xngj8x4{border-top-right-radius:6px}
|
|
116
|
+
.xmix8c7{height:18px}
|
|
117
|
+
.x17rw0jw{height:22px}
|
|
118
|
+
.x1fgtraw{height:28px}
|
|
119
|
+
.xc9qbxq{height:36px}
|
|
120
|
+
.xn3w4p2{height:44px}
|
|
121
|
+
.x161fk8o{left:23px}
|
|
122
|
+
.x4mh905{left:3px}
|
|
123
|
+
.xu0aao5{min-height:36px}
|
|
124
|
+
.x3sc9yq{min-height:46px}
|
|
125
|
+
.xeuugli{min-width:0}
|
|
126
|
+
.xxk6nc9{top:3px}
|
|
127
|
+
.x1xp8n7a{width:18px}
|
|
128
|
+
.x17z2i9w{width:22px}
|
|
129
|
+
.x1useyqa{width:48px}
|
|
130
|
+
.x129yw6v:hover{border-bottom-color:#e01b24}
|
|
131
|
+
.x19pfmzq:hover{border-bottom-color:rgba(0, 0, 0, 0.25)}
|
|
132
|
+
.xj3zwls:focus{border-bottom-color:#3584e4}
|
|
133
|
+
.x1xmy3i3:focus{border-bottom-color:#e01b24}
|
|
134
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
@layer priority1, priority2, priority3, priority4;
|
|
3
|
+
@layer priority1{
|
|
4
|
+
.x1ghz6dp{margin:0}
|
|
5
|
+
.x1717udv{padding:0}
|
|
6
|
+
}
|
|
7
|
+
@layer priority2{
|
|
8
|
+
.xng3xce{border-style:none}
|
|
9
|
+
.x1y0btm7{border-style:solid}
|
|
10
|
+
.xc342km{border-width:0}
|
|
11
|
+
.xmkeg23{border-width:1px}
|
|
12
|
+
.xe8uvvx{list-style:none}
|
|
13
|
+
.xysyzu8{overflow:auto}
|
|
14
|
+
.x1hl2dhg{text-decoration:none}
|
|
15
|
+
}
|
|
16
|
+
@layer priority3{
|
|
17
|
+
.xuw900x{aspect-ratio:attr(width) / attr(height)}
|
|
18
|
+
.x42x0ya{background-color:black}
|
|
19
|
+
.x9f619{box-sizing:border-box}
|
|
20
|
+
.x1lxnp44{font-family:monospace,"monospace"}
|
|
21
|
+
.xngnso2{font-size:1.5rem}
|
|
22
|
+
.xrv4cvt{font-size:1em}
|
|
23
|
+
.x117nqv4{font-weight:bold}
|
|
24
|
+
.x288g5{resize:vertical}
|
|
25
|
+
.x16tdsg8{text-align:inherit}
|
|
26
|
+
.x1vvkbs{word-wrap:break-word}
|
|
27
|
+
}
|
|
28
|
+
@layer priority4{
|
|
29
|
+
.xjm9jq1{height:1px}
|
|
30
|
+
.xt7dq6l{height:auto}
|
|
31
|
+
.x193iq5w{max-width:100%}
|
|
32
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { Button } from './Button';
|
|
2
|
+
export { Entry } from './Entry';
|
|
3
|
+
export { Switch } from './Switch';
|
|
4
|
+
export { Checkbox } from './Checkbox';
|
|
5
|
+
export { Card } from './Card';
|
|
6
|
+
export { HeaderBar } from './HeaderBar';
|
|
7
|
+
export { Box } from './Box';
|
|
8
|
+
export { theme, palette, radius, spacing, typography, motion } from './theme';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-export of the design tokens for runtime use by consumer code (e.g. for
|
|
3
|
+
* computing inline styles, reading the accent color in a custom component).
|
|
4
|
+
*
|
|
5
|
+
* The stylex-aware tokens live in `tokens.stylex.ts`. At runtime, defineConsts
|
|
6
|
+
* returns a plain object with the same keys/values — so we just re-export.
|
|
7
|
+
*/
|
|
8
|
+
export { palette, radius, spacing, typography, motion } from './tokens.css';
|
|
9
|
+
import { palette, radius, spacing, typography, motion } from './tokens.css';
|
|
10
|
+
export const theme = {
|
|
11
|
+
palette,
|
|
12
|
+
radius,
|
|
13
|
+
spacing,
|
|
14
|
+
typography,
|
|
15
|
+
motion
|
|
16
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import './_tokens/styles.css';
|
|
2
|
+
import { defaultStyles as _rsdDefaultStyles, merge as _rsdMerge } from "react-strict-dom/runtime";
|
|
3
|
+
import { css } from 'react-strict-dom';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Adwaita-inspired design tokens, exposed via `css.defineConsts` so they can
|
|
7
|
+
* be referenced inside `css.create({...})` calls. StyleX requires shared
|
|
8
|
+
* values to live in a `.stylex.ts` file and to be defined this way.
|
|
9
|
+
*
|
|
10
|
+
* NOTE: defineConsts only accepts string values. Numeric tokens (sizes,
|
|
11
|
+
* weights, line heights) are encoded as strings — CSS accepts them either
|
|
12
|
+
* way, and react-strict-dom forwards them through to RN as well.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export const palette = {
|
|
16
|
+
accentBg: "#3584e4",
|
|
17
|
+
accentBgHover: "#4a90e9",
|
|
18
|
+
accentBgActive: "#1a6bb8",
|
|
19
|
+
accentFg: "#ffffff",
|
|
20
|
+
destructiveBg: "#e01b24",
|
|
21
|
+
destructiveBgHover: "#e8434b",
|
|
22
|
+
destructiveBgActive: "#b81920",
|
|
23
|
+
destructiveFg: "#ffffff",
|
|
24
|
+
successBg: "#26a269",
|
|
25
|
+
warningBg: "#cd9309",
|
|
26
|
+
windowBg: "#fafafa",
|
|
27
|
+
viewBg: "#ffffff",
|
|
28
|
+
cardBg: "#ffffff",
|
|
29
|
+
headerbarBg: "#ebebeb",
|
|
30
|
+
sidebarBg: "#ebebeb",
|
|
31
|
+
fg: "rgba(0, 0, 0, 0.8)",
|
|
32
|
+
fgMuted: "rgba(0, 0, 0, 0.55)",
|
|
33
|
+
fgDisabled: "rgba(0, 0, 0, 0.35)",
|
|
34
|
+
fgOnAccent: "#ffffff",
|
|
35
|
+
border: "rgba(0, 0, 0, 0.15)",
|
|
36
|
+
borderStrong: "rgba(0, 0, 0, 0.25)",
|
|
37
|
+
shadow: "rgba(0, 0, 0, 0.07)",
|
|
38
|
+
subtleBg: "rgba(0, 0, 0, 0.07)",
|
|
39
|
+
subtleBgHover: "rgba(0, 0, 0, 0.12)",
|
|
40
|
+
subtleBgActive: "rgba(0, 0, 0, 0.18)"
|
|
41
|
+
};
|
|
42
|
+
export const radius = {
|
|
43
|
+
sm: "6px",
|
|
44
|
+
md: "9px",
|
|
45
|
+
lg: "12px",
|
|
46
|
+
pill: "9999px"
|
|
47
|
+
};
|
|
48
|
+
export const spacing = {
|
|
49
|
+
xs: "4px",
|
|
50
|
+
sm: "8px",
|
|
51
|
+
md: "12px",
|
|
52
|
+
lg: "16px",
|
|
53
|
+
xl: "24px",
|
|
54
|
+
xxl: "32px"
|
|
55
|
+
};
|
|
56
|
+
export const typography = {
|
|
57
|
+
fontFamily: "\"Adwaita Sans\", \"Cantarell\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", system-ui, sans-serif",
|
|
58
|
+
fontFamilyMono: "\"Adwaita Mono\", \"Source Code Pro\", ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
59
|
+
weightRegular: "400",
|
|
60
|
+
weightStrong: "600",
|
|
61
|
+
weightBold: "700",
|
|
62
|
+
bodySize: "14px",
|
|
63
|
+
bodyLineHeight: "1.5",
|
|
64
|
+
captionSize: "12px",
|
|
65
|
+
captionLineHeight: "1.4",
|
|
66
|
+
title4Size: "16px",
|
|
67
|
+
title4LineHeight: "1.3",
|
|
68
|
+
title3Size: "18px",
|
|
69
|
+
title3LineHeight: "1.3",
|
|
70
|
+
title2Size: "22px",
|
|
71
|
+
title2LineHeight: "1.25",
|
|
72
|
+
title1Size: "28px",
|
|
73
|
+
title1LineHeight: "1.2"
|
|
74
|
+
};
|
|
75
|
+
export const motion = {
|
|
76
|
+
durationFast: "120ms",
|
|
77
|
+
durationBase: "180ms",
|
|
78
|
+
easing: "cubic-bezier(0.4, 0, 0.2, 1)"
|
|
79
|
+
};
|
package/package.json
CHANGED
|
@@ -1,23 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webadwaita",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Cross-platform Adwaita-styled UI components built on react-strict-dom.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"sideEffects":
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.css"
|
|
8
|
+
],
|
|
7
9
|
"files": [
|
|
8
|
-
"
|
|
9
|
-
"babel.config.cjs",
|
|
10
|
+
"dist",
|
|
10
11
|
"README.md",
|
|
11
12
|
"LICENSE"
|
|
12
13
|
],
|
|
13
|
-
"main": "./
|
|
14
|
+
"main": "./dist/web/index.js",
|
|
15
|
+
"module": "./dist/web/index.js",
|
|
16
|
+
"types": "./dist/types/index.d.ts",
|
|
14
17
|
"exports": {
|
|
15
|
-
".":
|
|
16
|
-
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/types/index.d.ts",
|
|
20
|
+
"react-native": "./dist/native/index.js",
|
|
21
|
+
"default": "./dist/web/index.js"
|
|
22
|
+
},
|
|
17
23
|
"./package.json": "./package.json"
|
|
18
24
|
},
|
|
19
25
|
"scripts": {
|
|
26
|
+
"build": "node scripts/build.mjs",
|
|
20
27
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
28
|
+
"prepack": "npm run build",
|
|
21
29
|
"storybook:web": "npm --prefix apps/storybook-web run storybook",
|
|
22
30
|
"storybook:native": "npm --prefix apps/storybook-native run start"
|
|
23
31
|
},
|
|
@@ -28,12 +36,23 @@
|
|
|
28
36
|
"react-strict-dom": ">=0.0.50"
|
|
29
37
|
},
|
|
30
38
|
"peerDependenciesMeta": {
|
|
31
|
-
"react-dom": {
|
|
32
|
-
|
|
39
|
+
"react-dom": {
|
|
40
|
+
"optional": true
|
|
41
|
+
},
|
|
42
|
+
"react-native": {
|
|
43
|
+
"optional": true
|
|
44
|
+
}
|
|
33
45
|
},
|
|
34
46
|
"devDependencies": {
|
|
47
|
+
"@babel/cli": "^7.28.6",
|
|
48
|
+
"@babel/core": "^7.29.0",
|
|
49
|
+
"@babel/preset-env": "^7.29.5",
|
|
50
|
+
"@babel/preset-react": "^7.28.5",
|
|
51
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
35
52
|
"@types/react": "^19.2.5",
|
|
36
53
|
"@types/react-dom": "^19.2.3",
|
|
54
|
+
"postcss": "^8.5.14",
|
|
55
|
+
"postcss-react-strict-dom": "^0.0.55",
|
|
37
56
|
"react": "^19.2.0",
|
|
38
57
|
"react-dom": "^19.2.0",
|
|
39
58
|
"react-strict-dom": "^0.0.55",
|
package/babel.config.cjs
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared babel config used by Vite (web library build) and consumers
|
|
3
|
-
* who want to bundle WebAdwaita source through the react-strict-dom
|
|
4
|
-
* preset (e.g. Metro / Vite / Next.js postcss pipelines).
|
|
5
|
-
*/
|
|
6
|
-
const dev = process.env.NODE_ENV !== 'production';
|
|
7
|
-
|
|
8
|
-
module.exports = {
|
|
9
|
-
parserOpts: {
|
|
10
|
-
plugins: ['typescript', 'jsx']
|
|
11
|
-
},
|
|
12
|
-
presets: [
|
|
13
|
-
[
|
|
14
|
-
'react-strict-dom/babel-preset',
|
|
15
|
-
{
|
|
16
|
-
debug: dev,
|
|
17
|
-
dev,
|
|
18
|
-
rootDir: process.cwd(),
|
|
19
|
-
platform: process.env.WEBADWAITA_PLATFORM || 'web'
|
|
20
|
-
}
|
|
21
|
-
]
|
|
22
|
-
]
|
|
23
|
-
};
|
package/src/Box/index.tsx
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { css, html } from 'react-strict-dom';
|
|
3
|
-
import { spacing } from '../tokens.css';
|
|
4
|
-
|
|
5
|
-
type SpacingKey = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
|
|
6
|
-
type Direction = 'row' | 'column';
|
|
7
|
-
type Align = 'flex-start' | 'center' | 'flex-end' | 'stretch' | 'baseline';
|
|
8
|
-
type Justify =
|
|
9
|
-
| 'flex-start'
|
|
10
|
-
| 'center'
|
|
11
|
-
| 'flex-end'
|
|
12
|
-
| 'space-between'
|
|
13
|
-
| 'space-around'
|
|
14
|
-
| 'space-evenly';
|
|
15
|
-
|
|
16
|
-
export type BoxProps = {
|
|
17
|
-
children?: React.ReactNode;
|
|
18
|
-
direction?: Direction;
|
|
19
|
-
gap?: SpacingKey;
|
|
20
|
-
padding?: SpacingKey;
|
|
21
|
-
align?: Align;
|
|
22
|
-
justify?: Justify;
|
|
23
|
-
grow?: boolean;
|
|
24
|
-
wrap?: boolean;
|
|
25
|
-
style?: any;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Layout primitive — a flex container, the building block for everything else.
|
|
30
|
-
* Adwaita-inspired apps lean heavily on simple horizontal/vertical stacks.
|
|
31
|
-
*/
|
|
32
|
-
export function Box(props: BoxProps) {
|
|
33
|
-
const {
|
|
34
|
-
children,
|
|
35
|
-
direction = 'column',
|
|
36
|
-
gap,
|
|
37
|
-
padding,
|
|
38
|
-
align,
|
|
39
|
-
justify,
|
|
40
|
-
grow,
|
|
41
|
-
wrap,
|
|
42
|
-
style
|
|
43
|
-
} = props;
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<html.div
|
|
47
|
-
style={[
|
|
48
|
-
styles.base,
|
|
49
|
-
direction === 'row' ? styles.row : styles.column,
|
|
50
|
-
wrap && styles.wrap,
|
|
51
|
-
grow && styles.grow,
|
|
52
|
-
align != null && alignStyles[align],
|
|
53
|
-
justify != null && justifyStyles[justify],
|
|
54
|
-
gap != null && gapStyles[gap],
|
|
55
|
-
padding != null && paddingStyles[padding],
|
|
56
|
-
style
|
|
57
|
-
]}
|
|
58
|
-
>
|
|
59
|
-
{children}
|
|
60
|
-
</html.div>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const styles = css.create({
|
|
65
|
-
base: { display: 'flex', minWidth: 0 },
|
|
66
|
-
row: { flexDirection: 'row' },
|
|
67
|
-
column: { flexDirection: 'column' },
|
|
68
|
-
wrap: { flexWrap: 'wrap' },
|
|
69
|
-
grow: { flexGrow: 1 }
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
const alignStyles = css.create({
|
|
73
|
-
'flex-start': { alignItems: 'flex-start' },
|
|
74
|
-
center: { alignItems: 'center' },
|
|
75
|
-
'flex-end': { alignItems: 'flex-end' },
|
|
76
|
-
stretch: { alignItems: 'stretch' },
|
|
77
|
-
baseline: { alignItems: 'baseline' }
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
const justifyStyles = css.create({
|
|
81
|
-
'flex-start': { justifyContent: 'flex-start' },
|
|
82
|
-
center: { justifyContent: 'center' },
|
|
83
|
-
'flex-end': { justifyContent: 'flex-end' },
|
|
84
|
-
'space-between': { justifyContent: 'space-between' },
|
|
85
|
-
'space-around': { justifyContent: 'space-around' },
|
|
86
|
-
'space-evenly': { justifyContent: 'space-evenly' }
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
const gapStyles = css.create({
|
|
90
|
-
xs: { gap: spacing.xs },
|
|
91
|
-
sm: { gap: spacing.sm },
|
|
92
|
-
md: { gap: spacing.md },
|
|
93
|
-
lg: { gap: spacing.lg },
|
|
94
|
-
xl: { gap: spacing.xl },
|
|
95
|
-
xxl: { gap: spacing.xxl }
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
const paddingStyles = css.create({
|
|
99
|
-
xs: { padding: spacing.xs },
|
|
100
|
-
sm: { padding: spacing.sm },
|
|
101
|
-
md: { padding: spacing.md },
|
|
102
|
-
lg: { padding: spacing.lg },
|
|
103
|
-
xl: { padding: spacing.xl },
|
|
104
|
-
xxl: { padding: spacing.xxl }
|
|
105
|
-
});
|