braid-design-system 32.1.1 → 32.2.0
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/CHANGELOG.md +125 -0
- package/codemod/dist/wrapper.js +102 -104
- package/dist/ToastContext.chunk.cjs +21 -21
- package/dist/ToastContext.chunk.mjs +41 -41
- package/dist/Toggle.chunk.cjs +19 -29
- package/dist/Toggle.chunk.mjs +24 -34
- package/dist/reset.d.ts +190 -91
- package/dist/side-effects/lib/themes/baseTokens/apac.cjs +7 -8
- package/dist/side-effects/lib/themes/baseTokens/apac.mjs +6 -8
- package/dist/side-effects/lib/themes/makeRuntimeTokens.cjs +3 -9
- package/dist/side-effects/lib/themes/makeRuntimeTokens.mjs +3 -8
- package/dist/side-effects/lib/themes/tokenType.cjs +15 -0
- package/dist/side-effects/lib/themes/tokenType.mjs +16 -0
- package/dist/styles/lib/components/Button/Button.css.cjs +24 -23
- package/dist/styles/lib/components/Button/Button.css.mjs +25 -24
- package/dist/styles/lib/components/TooltipRenderer/TooltipRenderer.css.cjs +1 -5
- package/dist/styles/lib/components/TooltipRenderer/TooltipRenderer.css.mjs +1 -5
- package/dist/styles/lib/components/private/Keyline/Keyline.css.cjs +4 -0
- package/dist/styles/lib/components/private/Keyline/Keyline.css.mjs +5 -1
- package/dist/styles/lib/css/negativeMargin/negativeMargin.css.cjs +4 -9
- package/dist/styles/lib/css/negativeMargin/negativeMargin.css.mjs +1 -6
- package/dist/styles/lib/css/typography.css.cjs +1 -16
- package/dist/styles/lib/css/typography.css.mjs +1 -16
- package/dist/styles/lib/themes/docs/tokens.cjs +8 -8
- package/dist/styles/lib/themes/docs/tokens.mjs +6 -8
- package/dist/styles/lib/themes/makeVanillaTheme.cjs +22 -9
- package/dist/styles/lib/themes/makeVanillaTheme.mjs +22 -9
- package/dist/styles/lib/themes/wireframe/tokens.cjs +25 -29
- package/dist/styles/lib/themes/wireframe/tokens.mjs +23 -29
- package/package.json +3 -2
- package/dist/styles/lib/components/Badge/Badge.css.cjs +0 -27
- package/dist/styles/lib/components/Badge/Badge.css.mjs +0 -28
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import mapValues from "lodash/mapValues.js";
|
|
2
|
-
import values from "lodash/values.js";
|
|
3
2
|
import { isLight } from "../../../styles/lib/utils/index.mjs";
|
|
4
|
-
const makeWebFonts = (
|
|
3
|
+
const makeWebFonts = (webFont) => {
|
|
5
4
|
if (!webFont) {
|
|
6
5
|
return [];
|
|
7
6
|
}
|
|
8
|
-
|
|
9
|
-
const linkTag = `<link href="https://fonts.googleapis.com/css?family=${encodeURIComponent(
|
|
10
|
-
`${webFont}:${weights.sort().join(",")}`
|
|
11
|
-
)}" rel="stylesheet" />`;
|
|
12
|
-
return [{ linkTag }];
|
|
7
|
+
return [{ linkTag: `<link href="${webFont}" rel="stylesheet" />` }];
|
|
13
8
|
};
|
|
14
9
|
const makeRuntimeTokens = (tokens) => ({
|
|
15
10
|
name: tokens.name,
|
|
@@ -18,7 +13,7 @@ const makeRuntimeTokens = (tokens) => ({
|
|
|
18
13
|
lightMode: tokens.color.background.body,
|
|
19
14
|
darkMode: tokens.color.background.bodyDark
|
|
20
15
|
},
|
|
21
|
-
webFonts: makeWebFonts(tokens.typography),
|
|
16
|
+
webFonts: makeWebFonts(tokens.typography.webFont),
|
|
22
17
|
space: {
|
|
23
18
|
grid: tokens.grid,
|
|
24
19
|
space: tokens.space
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const extractFontMetricsForTheme = ({
|
|
3
|
+
capHeight,
|
|
4
|
+
ascent,
|
|
5
|
+
descent,
|
|
6
|
+
lineGap,
|
|
7
|
+
unitsPerEm
|
|
8
|
+
}) => ({
|
|
9
|
+
capHeight,
|
|
10
|
+
ascent,
|
|
11
|
+
descent,
|
|
12
|
+
lineGap,
|
|
13
|
+
unitsPerEm
|
|
14
|
+
});
|
|
15
|
+
exports.extractFontMetricsForTheme = extractFontMetricsForTheme;
|
|
@@ -7,9 +7,6 @@ const styles_lib_css_colorModeStyle_cjs = require("../../css/colorModeStyle.cjs"
|
|
|
7
7
|
const styles_lib_css_responsiveStyle_cjs = require("../../css/responsiveStyle.cjs");
|
|
8
8
|
const styles_lib_themes_vars_css_cjs = require("../../themes/vars.css.cjs");
|
|
9
9
|
fileScope.setFileScope("src/lib/components/Button/Button.css.ts?used", "braid-design-system");
|
|
10
|
-
const constants = {
|
|
11
|
-
smallButtonPaddingSize: "xsmall"
|
|
12
|
-
};
|
|
13
10
|
const root = css.style({
|
|
14
11
|
textDecoration: "none"
|
|
15
12
|
}, "root");
|
|
@@ -35,28 +32,32 @@ const focusOverlay = css.style({
|
|
|
35
32
|
}
|
|
36
33
|
}
|
|
37
34
|
}, "focusOverlay");
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const height = size === "small" ? cssUtils.calc.add(cssUtils.calc.multiply(styles_lib_themes_vars_css_cjs.vars.space[constants.smallButtonPaddingSize], 2), styles_lib_themes_vars_css_cjs.vars.textSize.small[breakpoint].lineHeight) : styles_lib_themes_vars_css_cjs.vars.touchableSize;
|
|
42
|
-
const value = cssUtils.calc(height).subtract(styles_lib_themes_vars_css_cjs.vars.textSize[size][breakpoint].capHeight).divide(2).negate().toString();
|
|
43
|
-
return {
|
|
44
|
-
marginTop: value,
|
|
45
|
-
marginBottom: value
|
|
46
|
-
};
|
|
35
|
+
const minHeightValueForSize = {
|
|
36
|
+
standard: styles_lib_themes_vars_css_cjs.vars.touchableSize,
|
|
37
|
+
small: cssUtils.calc.multiply(styles_lib_themes_vars_css_cjs.vars.touchableSize, 0.8)
|
|
47
38
|
};
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
tablet: stylesForBreakpoint("tablet", "standard")
|
|
53
|
-
}),
|
|
54
|
-
[`${small}&`]: styles_lib_css_responsiveStyle_cjs.responsiveStyle({
|
|
55
|
-
mobile: stylesForBreakpoint("mobile", "small"),
|
|
56
|
-
tablet: stylesForBreakpoint("tablet", "small")
|
|
57
|
-
})
|
|
39
|
+
const capHeightToMinHeight = css.createVar("capHeightToMinHeight");
|
|
40
|
+
const paddingVarForBreakpoint = (size, breakpoint) => ({
|
|
41
|
+
vars: {
|
|
42
|
+
[capHeightToMinHeight]: cssUtils.calc(minHeightValueForSize[size]).subtract(styles_lib_themes_vars_css_cjs.vars.textSize[size][breakpoint].capHeight).divide(2).toString()
|
|
58
43
|
}
|
|
44
|
+
});
|
|
45
|
+
const standard = css.style(styles_lib_css_responsiveStyle_cjs.responsiveStyle({
|
|
46
|
+
mobile: paddingVarForBreakpoint("standard", "mobile"),
|
|
47
|
+
tablet: paddingVarForBreakpoint("standard", "tablet")
|
|
48
|
+
}), "standard");
|
|
49
|
+
const small = css.style(styles_lib_css_responsiveStyle_cjs.responsiveStyle({
|
|
50
|
+
mobile: paddingVarForBreakpoint("small", "mobile"),
|
|
51
|
+
tablet: paddingVarForBreakpoint("small", "tablet")
|
|
52
|
+
}), "small");
|
|
53
|
+
const bleedVerticallyToCapHeight = css.style({
|
|
54
|
+
marginTop: cssUtils.calc.negate(capHeightToMinHeight),
|
|
55
|
+
marginBottom: cssUtils.calc.negate(capHeightToMinHeight)
|
|
59
56
|
}, "bleedVerticallyToCapHeight");
|
|
57
|
+
const padToMinHeight = css.style({
|
|
58
|
+
paddingTop: capHeightToMinHeight,
|
|
59
|
+
paddingBottom: capHeightToMinHeight
|
|
60
|
+
}, "padToMinHeight");
|
|
60
61
|
const dot1 = css.keyframes({
|
|
61
62
|
"14%": {
|
|
62
63
|
opacity: 0
|
|
@@ -134,13 +135,13 @@ const invertedBackgroundsDarkMode = css.styleVariants({
|
|
|
134
135
|
fileScope.endFileScope();
|
|
135
136
|
exports.activeOverlay = activeOverlay;
|
|
136
137
|
exports.bleedVerticallyToCapHeight = bleedVerticallyToCapHeight;
|
|
137
|
-
exports.constants = constants;
|
|
138
138
|
exports.focusOverlay = focusOverlay;
|
|
139
139
|
exports.forceActive = forceActive;
|
|
140
140
|
exports.hoverOverlay = hoverOverlay;
|
|
141
141
|
exports.invertedBackgroundsDarkMode = invertedBackgroundsDarkMode;
|
|
142
142
|
exports.invertedBackgroundsLightMode = invertedBackgroundsLightMode;
|
|
143
143
|
exports.loadingDot = loadingDot;
|
|
144
|
+
exports.padToMinHeight = padToMinHeight;
|
|
144
145
|
exports.root = root;
|
|
145
146
|
exports.small = small;
|
|
146
147
|
exports.standard = standard;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
|
|
2
|
-
import { style, keyframes, styleVariants } from "@vanilla-extract/css";
|
|
2
|
+
import { style, createVar, keyframes, styleVariants } from "@vanilla-extract/css";
|
|
3
3
|
import { calc } from "@vanilla-extract/css-utils";
|
|
4
4
|
import { rgba } from "polished";
|
|
5
5
|
import { colorModeStyle } from "../../css/colorModeStyle.mjs";
|
|
6
6
|
import { responsiveStyle } from "../../css/responsiveStyle.mjs";
|
|
7
7
|
import { vars } from "../../themes/vars.css.mjs";
|
|
8
8
|
setFileScope("src/lib/components/Button/Button.css.ts?used", "braid-design-system");
|
|
9
|
-
const constants = {
|
|
10
|
-
smallButtonPaddingSize: "xsmall"
|
|
11
|
-
};
|
|
12
9
|
const root = style({
|
|
13
10
|
textDecoration: "none"
|
|
14
11
|
}, "root");
|
|
@@ -34,28 +31,32 @@ const focusOverlay = style({
|
|
|
34
31
|
}
|
|
35
32
|
}
|
|
36
33
|
}, "focusOverlay");
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const height = size === "small" ? calc.add(calc.multiply(vars.space[constants.smallButtonPaddingSize], 2), vars.textSize.small[breakpoint].lineHeight) : vars.touchableSize;
|
|
41
|
-
const value = calc(height).subtract(vars.textSize[size][breakpoint].capHeight).divide(2).negate().toString();
|
|
42
|
-
return {
|
|
43
|
-
marginTop: value,
|
|
44
|
-
marginBottom: value
|
|
45
|
-
};
|
|
34
|
+
const minHeightValueForSize = {
|
|
35
|
+
standard: vars.touchableSize,
|
|
36
|
+
small: calc.multiply(vars.touchableSize, 0.8)
|
|
46
37
|
};
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
tablet: stylesForBreakpoint("tablet", "standard")
|
|
52
|
-
}),
|
|
53
|
-
[`${small}&`]: responsiveStyle({
|
|
54
|
-
mobile: stylesForBreakpoint("mobile", "small"),
|
|
55
|
-
tablet: stylesForBreakpoint("tablet", "small")
|
|
56
|
-
})
|
|
38
|
+
const capHeightToMinHeight = createVar("capHeightToMinHeight");
|
|
39
|
+
const paddingVarForBreakpoint = (size, breakpoint) => ({
|
|
40
|
+
vars: {
|
|
41
|
+
[capHeightToMinHeight]: calc(minHeightValueForSize[size]).subtract(vars.textSize[size][breakpoint].capHeight).divide(2).toString()
|
|
57
42
|
}
|
|
43
|
+
});
|
|
44
|
+
const standard = style(responsiveStyle({
|
|
45
|
+
mobile: paddingVarForBreakpoint("standard", "mobile"),
|
|
46
|
+
tablet: paddingVarForBreakpoint("standard", "tablet")
|
|
47
|
+
}), "standard");
|
|
48
|
+
const small = style(responsiveStyle({
|
|
49
|
+
mobile: paddingVarForBreakpoint("small", "mobile"),
|
|
50
|
+
tablet: paddingVarForBreakpoint("small", "tablet")
|
|
51
|
+
}), "small");
|
|
52
|
+
const bleedVerticallyToCapHeight = style({
|
|
53
|
+
marginTop: calc.negate(capHeightToMinHeight),
|
|
54
|
+
marginBottom: calc.negate(capHeightToMinHeight)
|
|
58
55
|
}, "bleedVerticallyToCapHeight");
|
|
56
|
+
const padToMinHeight = style({
|
|
57
|
+
paddingTop: capHeightToMinHeight,
|
|
58
|
+
paddingBottom: capHeightToMinHeight
|
|
59
|
+
}, "padToMinHeight");
|
|
59
60
|
const dot1 = keyframes({
|
|
60
61
|
"14%": {
|
|
61
62
|
opacity: 0
|
|
@@ -134,13 +135,13 @@ endFileScope();
|
|
|
134
135
|
export {
|
|
135
136
|
activeOverlay,
|
|
136
137
|
bleedVerticallyToCapHeight,
|
|
137
|
-
constants,
|
|
138
138
|
focusOverlay,
|
|
139
139
|
forceActive,
|
|
140
140
|
hoverOverlay,
|
|
141
141
|
invertedBackgroundsDarkMode,
|
|
142
142
|
invertedBackgroundsLightMode,
|
|
143
143
|
loadingDot,
|
|
144
|
+
padToMinHeight,
|
|
144
145
|
root,
|
|
145
146
|
small,
|
|
146
147
|
standard
|
|
@@ -25,10 +25,7 @@ const verticalOffsetBeforeEntrance = css.style({
|
|
|
25
25
|
const translateZ0 = css.style({
|
|
26
26
|
transform: "translateZ(0)"
|
|
27
27
|
}, "translateZ0");
|
|
28
|
-
const
|
|
29
|
-
padding: cssUtils.calc.add(styles_lib_themes_vars_css_cjs.vars.space.small, styles_lib_themes_vars_css_cjs.vars.grid)
|
|
30
|
-
}, "padding");
|
|
31
|
-
const borderRadius = styles_lib_themes_vars_css_cjs.vars.borderRadius.standard;
|
|
28
|
+
const borderRadius = styles_lib_themes_vars_css_cjs.vars.borderRadius.small;
|
|
32
29
|
const offset = cssUtils.calc(constants.arrowSize).divide(2).negate().toString();
|
|
33
30
|
const arrow = css.style({
|
|
34
31
|
visibility: "hidden",
|
|
@@ -63,6 +60,5 @@ fileScope.endFileScope();
|
|
|
63
60
|
exports.arrow = arrow;
|
|
64
61
|
exports.background = background;
|
|
65
62
|
exports.maxWidth = maxWidth;
|
|
66
|
-
exports.padding = padding;
|
|
67
63
|
exports.translateZ0 = translateZ0;
|
|
68
64
|
exports.verticalOffsetBeforeEntrance = verticalOffsetBeforeEntrance;
|
|
@@ -24,10 +24,7 @@ const verticalOffsetBeforeEntrance = style({
|
|
|
24
24
|
const translateZ0 = style({
|
|
25
25
|
transform: "translateZ(0)"
|
|
26
26
|
}, "translateZ0");
|
|
27
|
-
const
|
|
28
|
-
padding: calc.add(vars.space.small, vars.grid)
|
|
29
|
-
}, "padding");
|
|
30
|
-
const borderRadius = vars.borderRadius.standard;
|
|
27
|
+
const borderRadius = vars.borderRadius.small;
|
|
31
28
|
const offset = calc(constants.arrowSize).divide(2).negate().toString();
|
|
32
29
|
const arrow = style({
|
|
33
30
|
visibility: "hidden",
|
|
@@ -63,7 +60,6 @@ export {
|
|
|
63
60
|
arrow,
|
|
64
61
|
background,
|
|
65
62
|
maxWidth,
|
|
66
|
-
padding,
|
|
67
63
|
translateZ0,
|
|
68
64
|
verticalOffsetBeforeEntrance
|
|
69
65
|
};
|
|
@@ -58,9 +58,13 @@ const noRadiusOnRight = css.style({
|
|
|
58
58
|
const largestWidth = css.style({
|
|
59
59
|
width: styles_lib_themes_vars_css_cjs.vars.borderRadius.xlarge
|
|
60
60
|
}, "largestWidth");
|
|
61
|
+
const width = css.style({
|
|
62
|
+
width: styles_lib_themes_vars_css_cjs.vars.grid
|
|
63
|
+
}, "width");
|
|
61
64
|
fileScope.endFileScope();
|
|
62
65
|
exports.darkMode = darkMode;
|
|
63
66
|
exports.largestWidth = largestWidth;
|
|
64
67
|
exports.lightMode = lightMode;
|
|
65
68
|
exports.noRadiusOnRight = noRadiusOnRight;
|
|
66
69
|
exports.tone = tone;
|
|
70
|
+
exports.width = width;
|
|
@@ -57,11 +57,15 @@ const noRadiusOnRight = style({
|
|
|
57
57
|
const largestWidth = style({
|
|
58
58
|
width: vars.borderRadius.xlarge
|
|
59
59
|
}, "largestWidth");
|
|
60
|
+
const width = style({
|
|
61
|
+
width: vars.grid
|
|
62
|
+
}, "width");
|
|
60
63
|
endFileScope();
|
|
61
64
|
export {
|
|
62
65
|
darkMode,
|
|
63
66
|
largestWidth,
|
|
64
67
|
lightMode,
|
|
65
68
|
noRadiusOnRight,
|
|
66
|
-
tone
|
|
69
|
+
tone,
|
|
70
|
+
width
|
|
67
71
|
};
|
|
@@ -54,13 +54,8 @@ const right = {
|
|
|
54
54
|
wide: stylesForBreakpoint("wide", "marginRight")
|
|
55
55
|
};
|
|
56
56
|
fileScope.endFileScope();
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
bottom,
|
|
60
|
-
left,
|
|
61
|
-
preventCollapsePseudo,
|
|
62
|
-
right,
|
|
63
|
-
top
|
|
64
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
57
|
+
exports.bottom = bottom;
|
|
58
|
+
exports.left = left;
|
|
65
59
|
exports.preventCollapsePseudo = preventCollapsePseudo;
|
|
66
|
-
exports.
|
|
60
|
+
exports.right = right;
|
|
61
|
+
exports.top = top;
|
|
@@ -53,15 +53,10 @@ const right = {
|
|
|
53
53
|
wide: stylesForBreakpoint("wide", "marginRight")
|
|
54
54
|
};
|
|
55
55
|
endFileScope();
|
|
56
|
-
|
|
57
|
-
__proto__: null,
|
|
56
|
+
export {
|
|
58
57
|
bottom,
|
|
59
58
|
left,
|
|
60
59
|
preventCollapsePseudo,
|
|
61
60
|
right,
|
|
62
61
|
top
|
|
63
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
64
|
-
export {
|
|
65
|
-
preventCollapsePseudo,
|
|
66
|
-
styles
|
|
67
62
|
};
|
|
@@ -158,21 +158,6 @@ const touchableText = css.styleVariants(styles_lib_themes_vars_css_cjs.vars.text
|
|
|
158
158
|
tablet: makeTouchableSpacing(styles_lib_themes_vars_css_cjs.vars.touchableSize, textDefinition.tablet.lineHeight)
|
|
159
159
|
}), "touchableText");
|
|
160
160
|
fileScope.endFileScope();
|
|
161
|
-
const styles = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
162
|
-
__proto__: null,
|
|
163
|
-
darkModeNeutralOverride,
|
|
164
|
-
darkModeTone,
|
|
165
|
-
fontFamily,
|
|
166
|
-
fontWeight,
|
|
167
|
-
heading,
|
|
168
|
-
headingWeight,
|
|
169
|
-
lightModeNeutralOverride,
|
|
170
|
-
lightModeTone,
|
|
171
|
-
textSizeTrimmed,
|
|
172
|
-
textSizeUntrimmed,
|
|
173
|
-
tone,
|
|
174
|
-
touchableText
|
|
175
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
176
161
|
exports.darkModeNeutralOverride = darkModeNeutralOverride;
|
|
177
162
|
exports.darkModeTone = darkModeTone;
|
|
178
163
|
exports.fontFamily = fontFamily;
|
|
@@ -181,7 +166,7 @@ exports.heading = heading;
|
|
|
181
166
|
exports.headingWeight = headingWeight;
|
|
182
167
|
exports.lightModeNeutralOverride = lightModeNeutralOverride;
|
|
183
168
|
exports.lightModeTone = lightModeTone;
|
|
184
|
-
exports.
|
|
169
|
+
exports.textSizeTrimmed = textSizeTrimmed;
|
|
185
170
|
exports.textSizeUntrimmed = textSizeUntrimmed;
|
|
186
171
|
exports.tone = tone;
|
|
187
172
|
exports.touchableText = touchableText;
|
|
@@ -157,21 +157,6 @@ const touchableText = styleVariants(vars.textSize, (textDefinition) => responsiv
|
|
|
157
157
|
tablet: makeTouchableSpacing(vars.touchableSize, textDefinition.tablet.lineHeight)
|
|
158
158
|
}), "touchableText");
|
|
159
159
|
endFileScope();
|
|
160
|
-
const styles = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
161
|
-
__proto__: null,
|
|
162
|
-
darkModeNeutralOverride,
|
|
163
|
-
darkModeTone,
|
|
164
|
-
fontFamily,
|
|
165
|
-
fontWeight,
|
|
166
|
-
heading,
|
|
167
|
-
headingWeight,
|
|
168
|
-
lightModeNeutralOverride,
|
|
169
|
-
lightModeTone,
|
|
170
|
-
textSizeTrimmed,
|
|
171
|
-
textSizeUntrimmed,
|
|
172
|
-
tone,
|
|
173
|
-
touchableText
|
|
174
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
175
160
|
export {
|
|
176
161
|
darkModeNeutralOverride,
|
|
177
162
|
darkModeTone,
|
|
@@ -181,7 +166,7 @@ export {
|
|
|
181
166
|
headingWeight,
|
|
182
167
|
lightModeNeutralOverride,
|
|
183
168
|
lightModeTone,
|
|
184
|
-
|
|
169
|
+
textSizeTrimmed,
|
|
185
170
|
textSizeUntrimmed,
|
|
186
171
|
tone,
|
|
187
172
|
touchableText
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
const appleSystemMetrics = require("@capsizecss/metrics/appleSystem.js");
|
|
2
3
|
const polished = require("polished");
|
|
3
4
|
const sideEffects_lib_themes_baseTokens_apac_cjs = require("../../../../side-effects/lib/themes/baseTokens/apac.cjs");
|
|
5
|
+
const sideEffects_lib_themes_tokenType_cjs = require("../../../../side-effects/lib/themes/tokenType.cjs");
|
|
6
|
+
const _interopDefaultCompat = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
|
|
7
|
+
const appleSystemMetrics__default = /* @__PURE__ */ _interopDefaultCompat(appleSystemMetrics);
|
|
4
8
|
const brandAccent = sideEffects_lib_themes_baseTokens_apac_cjs.palette.grey["900"];
|
|
5
9
|
const formAccent = sideEffects_lib_themes_baseTokens_apac_cjs.palette.indigo["600"];
|
|
6
10
|
const focus = polished.rgba("#1e90ff", 0.7);
|
|
@@ -15,13 +19,7 @@ const tokens = {
|
|
|
15
19
|
typography: {
|
|
16
20
|
fontFamily: '-apple-system, BlinkMacSystemFont, Roboto, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
|
|
17
21
|
webFont: null,
|
|
18
|
-
fontMetrics:
|
|
19
|
-
capHeight: 1443,
|
|
20
|
-
ascent: 1950,
|
|
21
|
-
descent: -494,
|
|
22
|
-
lineGap: 0,
|
|
23
|
-
unitsPerEm: 2048
|
|
24
|
-
},
|
|
22
|
+
fontMetrics: sideEffects_lib_themes_tokenType_cjs.extractFontMetricsForTheme(appleSystemMetrics__default.default),
|
|
25
23
|
fontWeight: {
|
|
26
24
|
regular: 400,
|
|
27
25
|
medium: 500,
|
|
@@ -134,7 +132,8 @@ const tokens = {
|
|
|
134
132
|
medium: 5,
|
|
135
133
|
large: 8,
|
|
136
134
|
xlarge: 11,
|
|
137
|
-
xxlarge: 15
|
|
135
|
+
xxlarge: 15,
|
|
136
|
+
xxxlarge: 20
|
|
138
137
|
},
|
|
139
138
|
transforms: {
|
|
140
139
|
touchable: "scale(0.97)"
|
|
@@ -145,6 +144,7 @@ const tokens = {
|
|
|
145
144
|
},
|
|
146
145
|
border: {
|
|
147
146
|
radius: {
|
|
147
|
+
small: "4px",
|
|
148
148
|
standard: "6px",
|
|
149
149
|
large: "8px",
|
|
150
150
|
xlarge: "12px"
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import appleSystemMetrics from "@capsizecss/metrics/appleSystem.js";
|
|
1
2
|
import { rgba, darken, lighten } from "polished";
|
|
2
3
|
import { palette } from "../../../../side-effects/lib/themes/baseTokens/apac.mjs";
|
|
4
|
+
import { extractFontMetricsForTheme } from "../../../../side-effects/lib/themes/tokenType.mjs";
|
|
3
5
|
const brandAccent = palette.grey["900"];
|
|
4
6
|
const formAccent = palette.indigo["600"];
|
|
5
7
|
const focus = rgba("#1e90ff", 0.7);
|
|
@@ -14,13 +16,7 @@ const tokens = {
|
|
|
14
16
|
typography: {
|
|
15
17
|
fontFamily: '-apple-system, BlinkMacSystemFont, Roboto, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',
|
|
16
18
|
webFont: null,
|
|
17
|
-
fontMetrics:
|
|
18
|
-
capHeight: 1443,
|
|
19
|
-
ascent: 1950,
|
|
20
|
-
descent: -494,
|
|
21
|
-
lineGap: 0,
|
|
22
|
-
unitsPerEm: 2048
|
|
23
|
-
},
|
|
19
|
+
fontMetrics: extractFontMetricsForTheme(appleSystemMetrics),
|
|
24
20
|
fontWeight: {
|
|
25
21
|
regular: 400,
|
|
26
22
|
medium: 500,
|
|
@@ -133,7 +129,8 @@ const tokens = {
|
|
|
133
129
|
medium: 5,
|
|
134
130
|
large: 8,
|
|
135
131
|
xlarge: 11,
|
|
136
|
-
xxlarge: 15
|
|
132
|
+
xxlarge: 15,
|
|
133
|
+
xxxlarge: 20
|
|
137
134
|
},
|
|
138
135
|
transforms: {
|
|
139
136
|
touchable: "scale(0.97)"
|
|
@@ -144,6 +141,7 @@ const tokens = {
|
|
|
144
141
|
},
|
|
145
142
|
border: {
|
|
146
143
|
radius: {
|
|
144
|
+
small: "4px",
|
|
147
145
|
standard: "6px",
|
|
148
146
|
large: "8px",
|
|
149
147
|
xlarge: "12px"
|
|
@@ -15,13 +15,26 @@ const fontSizeToCapHeight = (grid, definition, fontMetrics) => {
|
|
|
15
15
|
fontSize: tablet.fontSize,
|
|
16
16
|
fontMetrics
|
|
17
17
|
});
|
|
18
|
+
const mobileConfig = "lineGap" in mobile ? {
|
|
19
|
+
fontSize: mobile.fontSize,
|
|
20
|
+
lineGap: mobile.lineGap
|
|
21
|
+
} : {
|
|
22
|
+
fontSize: mobile.fontSize,
|
|
23
|
+
leading: mobile.rows * grid
|
|
24
|
+
};
|
|
25
|
+
const tabletConfig = "lineGap" in tablet ? {
|
|
26
|
+
fontSize: tablet.fontSize,
|
|
27
|
+
lineGap: tablet.lineGap
|
|
28
|
+
} : {
|
|
29
|
+
fontSize: tablet.fontSize,
|
|
30
|
+
leading: tablet.rows * grid
|
|
31
|
+
};
|
|
18
32
|
const {
|
|
19
33
|
fontSize: mobileFontSize,
|
|
20
34
|
lineHeight: mobileLineHeight,
|
|
21
35
|
...mobileTrims
|
|
22
36
|
} = vanillaExtract.precomputeValues({
|
|
23
|
-
|
|
24
|
-
leading: mobile.rows * grid,
|
|
37
|
+
...mobileConfig,
|
|
25
38
|
fontMetrics
|
|
26
39
|
});
|
|
27
40
|
const {
|
|
@@ -29,8 +42,7 @@ const fontSizeToCapHeight = (grid, definition, fontMetrics) => {
|
|
|
29
42
|
lineHeight: tabletLineHeight,
|
|
30
43
|
...tabletTrims
|
|
31
44
|
} = vanillaExtract.precomputeValues({
|
|
32
|
-
|
|
33
|
-
leading: tablet.rows * grid,
|
|
45
|
+
...tabletConfig,
|
|
34
46
|
fontMetrics
|
|
35
47
|
});
|
|
36
48
|
return {
|
|
@@ -56,8 +68,12 @@ const makeVanillaTheme = (braidTokens) => {
|
|
|
56
68
|
const { name, displayName, ...tokens } = braidTokens;
|
|
57
69
|
const { webFont, ...typography } = tokens.typography;
|
|
58
70
|
const { foreground, background } = tokens.color;
|
|
71
|
+
const textSize = mapValues__default.default(
|
|
72
|
+
tokens.typography.text,
|
|
73
|
+
(definition) => fontSizeToCapHeight(tokens.grid, definition, typography.fontMetrics)
|
|
74
|
+
);
|
|
59
75
|
const getInlineFieldSize = (size) => {
|
|
60
|
-
const scale =
|
|
76
|
+
const scale = parseInt(textSize[size].mobile.lineHeight, 10) / 42;
|
|
61
77
|
return px(tokens.grid * Math.round(tokens.touchableSize * scale));
|
|
62
78
|
};
|
|
63
79
|
const resolvedTokens = {
|
|
@@ -73,10 +89,7 @@ const makeVanillaTheme = (braidTokens) => {
|
|
|
73
89
|
backgroundColor: background,
|
|
74
90
|
fontFamily: typography.fontFamily,
|
|
75
91
|
fontMetrics: mapValues__default.default(typography.fontMetrics, String),
|
|
76
|
-
textSize
|
|
77
|
-
tokens.typography.text,
|
|
78
|
-
(definition) => fontSizeToCapHeight(tokens.grid, definition, typography.fontMetrics)
|
|
79
|
-
),
|
|
92
|
+
textSize,
|
|
80
93
|
textWeight: mapValues__default.default(typography.fontWeight, String),
|
|
81
94
|
headingLevel: mapValues__default.default(
|
|
82
95
|
tokens.typography.heading.level,
|
|
@@ -12,13 +12,26 @@ const fontSizeToCapHeight = (grid, definition, fontMetrics) => {
|
|
|
12
12
|
fontSize: tablet.fontSize,
|
|
13
13
|
fontMetrics
|
|
14
14
|
});
|
|
15
|
+
const mobileConfig = "lineGap" in mobile ? {
|
|
16
|
+
fontSize: mobile.fontSize,
|
|
17
|
+
lineGap: mobile.lineGap
|
|
18
|
+
} : {
|
|
19
|
+
fontSize: mobile.fontSize,
|
|
20
|
+
leading: mobile.rows * grid
|
|
21
|
+
};
|
|
22
|
+
const tabletConfig = "lineGap" in tablet ? {
|
|
23
|
+
fontSize: tablet.fontSize,
|
|
24
|
+
lineGap: tablet.lineGap
|
|
25
|
+
} : {
|
|
26
|
+
fontSize: tablet.fontSize,
|
|
27
|
+
leading: tablet.rows * grid
|
|
28
|
+
};
|
|
15
29
|
const {
|
|
16
30
|
fontSize: mobileFontSize,
|
|
17
31
|
lineHeight: mobileLineHeight,
|
|
18
32
|
...mobileTrims
|
|
19
33
|
} = precomputeValues({
|
|
20
|
-
|
|
21
|
-
leading: mobile.rows * grid,
|
|
34
|
+
...mobileConfig,
|
|
22
35
|
fontMetrics
|
|
23
36
|
});
|
|
24
37
|
const {
|
|
@@ -26,8 +39,7 @@ const fontSizeToCapHeight = (grid, definition, fontMetrics) => {
|
|
|
26
39
|
lineHeight: tabletLineHeight,
|
|
27
40
|
...tabletTrims
|
|
28
41
|
} = precomputeValues({
|
|
29
|
-
|
|
30
|
-
leading: tablet.rows * grid,
|
|
42
|
+
...tabletConfig,
|
|
31
43
|
fontMetrics
|
|
32
44
|
});
|
|
33
45
|
return {
|
|
@@ -53,8 +65,12 @@ const makeVanillaTheme = (braidTokens) => {
|
|
|
53
65
|
const { name, displayName, ...tokens } = braidTokens;
|
|
54
66
|
const { webFont, ...typography } = tokens.typography;
|
|
55
67
|
const { foreground, background } = tokens.color;
|
|
68
|
+
const textSize = mapValues(
|
|
69
|
+
tokens.typography.text,
|
|
70
|
+
(definition) => fontSizeToCapHeight(tokens.grid, definition, typography.fontMetrics)
|
|
71
|
+
);
|
|
56
72
|
const getInlineFieldSize = (size) => {
|
|
57
|
-
const scale =
|
|
73
|
+
const scale = parseInt(textSize[size].mobile.lineHeight, 10) / 42;
|
|
58
74
|
return px(tokens.grid * Math.round(tokens.touchableSize * scale));
|
|
59
75
|
};
|
|
60
76
|
const resolvedTokens = {
|
|
@@ -70,10 +86,7 @@ const makeVanillaTheme = (braidTokens) => {
|
|
|
70
86
|
backgroundColor: background,
|
|
71
87
|
fontFamily: typography.fontFamily,
|
|
72
88
|
fontMetrics: mapValues(typography.fontMetrics, String),
|
|
73
|
-
textSize
|
|
74
|
-
tokens.typography.text,
|
|
75
|
-
(definition) => fontSizeToCapHeight(tokens.grid, definition, typography.fontMetrics)
|
|
76
|
-
),
|
|
89
|
+
textSize,
|
|
77
90
|
textWeight: mapValues(typography.fontWeight, String),
|
|
78
91
|
headingLevel: mapValues(
|
|
79
92
|
tokens.typography.heading.level,
|