@react-xp/design-system 1.0.0-beta.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/LICENSE +21 -0
- package/README.md +325 -0
- package/dist/cjs/helpers/a11y.js +176 -0
- package/dist/cjs/helpers/index.js +18 -0
- package/dist/cjs/helpers/styles.js +172 -0
- package/dist/cjs/index.js +19 -0
- package/dist/cjs/styles/avatars.js +63 -0
- package/dist/cjs/styles/badges.js +59 -0
- package/dist/cjs/styles/bottomSheets.js +76 -0
- package/dist/cjs/styles/buttons.js +129 -0
- package/dist/cjs/styles/cards.js +71 -0
- package/dist/cjs/styles/checkboxes.js +70 -0
- package/dist/cjs/styles/chips.js +98 -0
- package/dist/cjs/styles/datePickers.js +113 -0
- package/dist/cjs/styles/dividers.js +12 -0
- package/dist/cjs/styles/emptyStates.js +40 -0
- package/dist/cjs/styles/forms.js +32 -0
- package/dist/cjs/styles/headers.js +46 -0
- package/dist/cjs/styles/index.js +43 -0
- package/dist/cjs/styles/inputs.js +101 -0
- package/dist/cjs/styles/listItems.js +65 -0
- package/dist/cjs/styles/modals.js +92 -0
- package/dist/cjs/styles/pagination.js +39 -0
- package/dist/cjs/styles/popovers.js +64 -0
- package/dist/cjs/styles/progress.js +33 -0
- package/dist/cjs/styles/radios.js +70 -0
- package/dist/cjs/styles/selects.js +137 -0
- package/dist/cjs/styles/skeletons.js +34 -0
- package/dist/cjs/styles/steppers.js +71 -0
- package/dist/cjs/styles/switches.js +76 -0
- package/dist/cjs/styles/tables.js +57 -0
- package/dist/cjs/styles/tabs.js +71 -0
- package/dist/cjs/styles/toasts.js +82 -0
- package/dist/cjs/styles/tooltips.js +46 -0
- package/dist/cjs/types/index.js +18 -0
- package/dist/cjs/types/states.js +8 -0
- package/dist/cjs/types/tokens.js +18 -0
- package/dist/esm/helpers/a11y.js +169 -0
- package/dist/esm/helpers/index.js +2 -0
- package/dist/esm/helpers/styles.js +158 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/styles/avatars.js +59 -0
- package/dist/esm/styles/badges.js +55 -0
- package/dist/esm/styles/bottomSheets.js +72 -0
- package/dist/esm/styles/buttons.js +125 -0
- package/dist/esm/styles/cards.js +67 -0
- package/dist/esm/styles/checkboxes.js +66 -0
- package/dist/esm/styles/chips.js +94 -0
- package/dist/esm/styles/datePickers.js +108 -0
- package/dist/esm/styles/dividers.js +8 -0
- package/dist/esm/styles/emptyStates.js +36 -0
- package/dist/esm/styles/forms.js +28 -0
- package/dist/esm/styles/headers.js +42 -0
- package/dist/esm/styles/index.js +27 -0
- package/dist/esm/styles/inputs.js +97 -0
- package/dist/esm/styles/listItems.js +61 -0
- package/dist/esm/styles/modals.js +88 -0
- package/dist/esm/styles/pagination.js +35 -0
- package/dist/esm/styles/popovers.js +60 -0
- package/dist/esm/styles/progress.js +27 -0
- package/dist/esm/styles/radios.js +66 -0
- package/dist/esm/styles/selects.js +133 -0
- package/dist/esm/styles/skeletons.js +29 -0
- package/dist/esm/styles/steppers.js +66 -0
- package/dist/esm/styles/switches.js +72 -0
- package/dist/esm/styles/tables.js +53 -0
- package/dist/esm/styles/tabs.js +66 -0
- package/dist/esm/styles/toasts.js +77 -0
- package/dist/esm/styles/tooltips.js +42 -0
- package/dist/esm/types/index.js +2 -0
- package/dist/esm/types/states.js +3 -0
- package/dist/esm/types/tokens.js +12 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.esm.tsbuildinfo +1 -0
- package/dist/types/helpers/a11y.d.ts +20 -0
- package/dist/types/helpers/a11y.d.ts.map +1 -0
- package/dist/types/helpers/index.d.ts +3 -0
- package/dist/types/helpers/index.d.ts.map +1 -0
- package/dist/types/helpers/styles.d.ts +31 -0
- package/dist/types/helpers/styles.d.ts.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/styles/avatars.d.ts +10 -0
- package/dist/types/styles/avatars.d.ts.map +1 -0
- package/dist/types/styles/badges.d.ts +8 -0
- package/dist/types/styles/badges.d.ts.map +1 -0
- package/dist/types/styles/bottomSheets.d.ts +15 -0
- package/dist/types/styles/bottomSheets.d.ts.map +1 -0
- package/dist/types/styles/buttons.d.ts +22 -0
- package/dist/types/styles/buttons.d.ts.map +1 -0
- package/dist/types/styles/cards.d.ts +18 -0
- package/dist/types/styles/cards.d.ts.map +1 -0
- package/dist/types/styles/checkboxes.d.ts +18 -0
- package/dist/types/styles/checkboxes.d.ts.map +1 -0
- package/dist/types/styles/chips.d.ts +20 -0
- package/dist/types/styles/chips.d.ts.map +1 -0
- package/dist/types/styles/datePickers.d.ts +30 -0
- package/dist/types/styles/datePickers.d.ts.map +1 -0
- package/dist/types/styles/dividers.d.ts +4 -0
- package/dist/types/styles/dividers.d.ts.map +1 -0
- package/dist/types/styles/emptyStates.d.ts +10 -0
- package/dist/types/styles/emptyStates.d.ts.map +1 -0
- package/dist/types/styles/forms.d.ts +10 -0
- package/dist/types/styles/forms.d.ts.map +1 -0
- package/dist/types/styles/headers.d.ts +11 -0
- package/dist/types/styles/headers.d.ts.map +1 -0
- package/dist/types/styles/index.d.ts +28 -0
- package/dist/types/styles/index.d.ts.map +1 -0
- package/dist/types/styles/inputs.d.ts +19 -0
- package/dist/types/styles/inputs.d.ts.map +1 -0
- package/dist/types/styles/listItems.d.ts +19 -0
- package/dist/types/styles/listItems.d.ts.map +1 -0
- package/dist/types/styles/modals.d.ts +15 -0
- package/dist/types/styles/modals.d.ts.map +1 -0
- package/dist/types/styles/pagination.d.ts +9 -0
- package/dist/types/styles/pagination.d.ts.map +1 -0
- package/dist/types/styles/popovers.d.ts +12 -0
- package/dist/types/styles/popovers.d.ts.map +1 -0
- package/dist/types/styles/progress.d.ts +11 -0
- package/dist/types/styles/progress.d.ts.map +1 -0
- package/dist/types/styles/radios.d.ts +17 -0
- package/dist/types/styles/radios.d.ts.map +1 -0
- package/dist/types/styles/selects.d.ts +25 -0
- package/dist/types/styles/selects.d.ts.map +1 -0
- package/dist/types/styles/skeletons.d.ts +13 -0
- package/dist/types/styles/skeletons.d.ts.map +1 -0
- package/dist/types/styles/steppers.d.ts +21 -0
- package/dist/types/styles/steppers.d.ts.map +1 -0
- package/dist/types/styles/switches.d.ts +17 -0
- package/dist/types/styles/switches.d.ts.map +1 -0
- package/dist/types/styles/tables.d.ts +13 -0
- package/dist/types/styles/tables.d.ts.map +1 -0
- package/dist/types/styles/tabs.d.ts +19 -0
- package/dist/types/styles/tabs.d.ts.map +1 -0
- package/dist/types/styles/toasts.d.ts +13 -0
- package/dist/types/styles/toasts.d.ts.map +1 -0
- package/dist/types/styles/tooltips.d.ts +9 -0
- package/dist/types/styles/tooltips.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +3 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/types/states.d.ts +26 -0
- package/dist/types/types/states.d.ts.map +1 -0
- package/dist/types/types/tokens.d.ts +16 -0
- package/dist/types/types/tokens.d.ts.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// styles/style-bridge.ts
|
|
3
|
+
// Binding helpers (Web + React Native):
|
|
4
|
+
// - normalização px<->number
|
|
5
|
+
// - filtrar props web-only/native-only
|
|
6
|
+
// - mapear shadow tokens (CSS box-shadow) para RN shadow props
|
|
7
|
+
// - focus ring cross-platform (wrapper approach)
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.getFocusWrapperSx = exports.getFocusRingSx = exports.resolveShadow = exports.pickSxForPlatform = exports.getFocusRingGap = exports.getTapTargetMin = exports.getBorderWidthFocus = exports.getBorderWidthDefault = exports.normalizeValueForPlatform = exports.toPx = exports.toNumber = void 0;
|
|
10
|
+
// Nota: aqui não dependemos das tuas primitives — isto é “infra” para o teu runtime/binding.
|
|
11
|
+
const types_1 = require("../types");
|
|
12
|
+
/**
|
|
13
|
+
* Tokens utilitários são string com px (ex.: "1px", "44px")
|
|
14
|
+
* No RN queres number (dp), no Web queres string (px) — define UMA regra no teu binder.
|
|
15
|
+
*/
|
|
16
|
+
const toNumber = (value) => {
|
|
17
|
+
if (typeof value === 'number')
|
|
18
|
+
return value;
|
|
19
|
+
const n = Number.parseFloat(value);
|
|
20
|
+
if (Number.isNaN(n)) {
|
|
21
|
+
throw new Error(`toNumber: cannot parse "${value}"`);
|
|
22
|
+
}
|
|
23
|
+
return n;
|
|
24
|
+
};
|
|
25
|
+
exports.toNumber = toNumber;
|
|
26
|
+
const toPx = (value) => {
|
|
27
|
+
if (typeof value === 'string')
|
|
28
|
+
return value;
|
|
29
|
+
return `${value}px`;
|
|
30
|
+
};
|
|
31
|
+
exports.toPx = toPx;
|
|
32
|
+
const normalizeValueForPlatform = (platform, value) => {
|
|
33
|
+
// Recomendação: RN -> number; Web -> string (se vier "px")
|
|
34
|
+
if (platform === 'native')
|
|
35
|
+
return (0, exports.toNumber)(value);
|
|
36
|
+
return typeof value === 'string' ? value : (0, exports.toPx)(value);
|
|
37
|
+
};
|
|
38
|
+
exports.normalizeValueForPlatform = normalizeValueForPlatform;
|
|
39
|
+
const getBorderWidthDefault = (t, platform) => (0, exports.normalizeValueForPlatform)(platform, (0, types_1.tok)(t, 'border-width-default'));
|
|
40
|
+
exports.getBorderWidthDefault = getBorderWidthDefault;
|
|
41
|
+
const getBorderWidthFocus = (t, platform) => (0, exports.normalizeValueForPlatform)(platform, (0, types_1.tok)(t, 'border-width-focus'));
|
|
42
|
+
exports.getBorderWidthFocus = getBorderWidthFocus;
|
|
43
|
+
const getTapTargetMin = (t, platform) => (0, exports.normalizeValueForPlatform)(platform, (0, types_1.tok)(t, 'tap-target-min'));
|
|
44
|
+
exports.getTapTargetMin = getTapTargetMin;
|
|
45
|
+
const getFocusRingGap = (t, platform) => (0, exports.normalizeValueForPlatform)(platform, (0, types_1.tok)(t, 'focus-ring-gap'));
|
|
46
|
+
exports.getFocusRingGap = getFocusRingGap;
|
|
47
|
+
/**
|
|
48
|
+
* Filtragem de props por plataforma:
|
|
49
|
+
* - Evita drift: pessoas a usarem `outline*` em RN sem perceberem que não faz nada.
|
|
50
|
+
*/
|
|
51
|
+
const WEB_ONLY_KEYS = new Set([
|
|
52
|
+
'outlineStyle',
|
|
53
|
+
'outlineWidth',
|
|
54
|
+
'outlineColor',
|
|
55
|
+
'outlineOffset',
|
|
56
|
+
'inset',
|
|
57
|
+
'boxShadow',
|
|
58
|
+
'cursor',
|
|
59
|
+
]);
|
|
60
|
+
const NATIVE_ONLY_KEYS = new Set([
|
|
61
|
+
'elevation',
|
|
62
|
+
'shadowColor',
|
|
63
|
+
'shadowOpacity',
|
|
64
|
+
'shadowRadius',
|
|
65
|
+
'shadowOffset',
|
|
66
|
+
]);
|
|
67
|
+
const pickSxForPlatform = (platform, sx) => {
|
|
68
|
+
const out = {};
|
|
69
|
+
for (const [k, v] of Object.entries(sx)) {
|
|
70
|
+
if (v === undefined)
|
|
71
|
+
continue;
|
|
72
|
+
if (platform === 'web') {
|
|
73
|
+
if (NATIVE_ONLY_KEYS.has(k))
|
|
74
|
+
continue;
|
|
75
|
+
out[k] = v;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
if (WEB_ONLY_KEYS.has(k))
|
|
79
|
+
continue;
|
|
80
|
+
out[k] = v;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return out;
|
|
84
|
+
};
|
|
85
|
+
exports.pickSxForPlatform = pickSxForPlatform;
|
|
86
|
+
const parseRgba = (input) => {
|
|
87
|
+
// rgba(15, 23, 42, 0.18)
|
|
88
|
+
const m = input.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([0-9.]+))?\s*\)/i);
|
|
89
|
+
if (!m)
|
|
90
|
+
return null;
|
|
91
|
+
const r = Number(m[1]);
|
|
92
|
+
const g = Number(m[2]);
|
|
93
|
+
const b = Number(m[3]);
|
|
94
|
+
const a = m[4] ? Number(m[4]) : 1;
|
|
95
|
+
return { r, g, b, a };
|
|
96
|
+
};
|
|
97
|
+
const rgbaToHex = ({ r, g, b }) => {
|
|
98
|
+
const to2 = (n) => Math.max(0, Math.min(255, n)).toString(16).padStart(2, '0');
|
|
99
|
+
return `#${to2(r)}${to2(g)}${to2(b)}`;
|
|
100
|
+
};
|
|
101
|
+
const parseFirstBoxShadow = (shadow) => {
|
|
102
|
+
// Ex.: "0 10px 15px rgba(15, 23, 42, 0.18), 0 4px 6px rgba(...)"
|
|
103
|
+
// Vamos pegar só na primeira parte antes da vírgula de separação de shadows (não a do rgba).
|
|
104
|
+
const parts = shadow.split('),').slice(0, 1).join('),');
|
|
105
|
+
const rgba = parseRgba(parts);
|
|
106
|
+
if (!rgba)
|
|
107
|
+
return null;
|
|
108
|
+
// Tenta capturar "x y blur"
|
|
109
|
+
// "0 10px 15px rgba(...)"
|
|
110
|
+
const mm = parts.match(/(-?\d+(?:\.\d+)?)px?\s+(-?\d+(?:\.\d+)?)px?\s+(\d+(?:\.\d+)?)px?/);
|
|
111
|
+
if (!mm)
|
|
112
|
+
return null;
|
|
113
|
+
const offsetX = Number(mm[1]);
|
|
114
|
+
const offsetY = Number(mm[2]);
|
|
115
|
+
const blur = Number(mm[3]);
|
|
116
|
+
return { rgba, offsetX, offsetY, blur };
|
|
117
|
+
};
|
|
118
|
+
const resolveShadow = (t, platform, shadowToken) => {
|
|
119
|
+
const shadowStr = (0, types_1.tok)(t, shadowToken);
|
|
120
|
+
if (platform === 'web') {
|
|
121
|
+
return { boxShadow: shadowStr };
|
|
122
|
+
}
|
|
123
|
+
const parsed = parseFirstBoxShadow(shadowStr);
|
|
124
|
+
if (!parsed) {
|
|
125
|
+
// fallback seguro (sem shadow)
|
|
126
|
+
return {};
|
|
127
|
+
}
|
|
128
|
+
const { rgba, offsetX, offsetY, blur } = parsed;
|
|
129
|
+
// Heurística RN:
|
|
130
|
+
// - shadowRadius: blur/2 (aproximação)
|
|
131
|
+
// - elevation: blur/2 (aproximação)
|
|
132
|
+
// - shadowOffset: offset
|
|
133
|
+
return {
|
|
134
|
+
shadowColor: rgbaToHex(rgba),
|
|
135
|
+
shadowOpacity: rgba.a,
|
|
136
|
+
shadowRadius: Math.max(0, blur / 2),
|
|
137
|
+
shadowOffset: { width: offsetX, height: offsetY },
|
|
138
|
+
elevation: Math.max(1, Math.round(blur / 2)),
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
exports.resolveShadow = resolveShadow;
|
|
142
|
+
const getFocusRingSx = (t, platform, opts) => {
|
|
143
|
+
const borderRadius = opts?.borderRadius;
|
|
144
|
+
if (platform === 'web') {
|
|
145
|
+
return {
|
|
146
|
+
outlineStyle: 'solid',
|
|
147
|
+
outlineWidth: (0, types_1.tok)(t, 'border-width-focus'),
|
|
148
|
+
outlineColor: (0, types_1.tok)(t, 'color-focus-ring'),
|
|
149
|
+
outlineOffset: (0, types_1.tok)(t, 'focus-ring-gap'),
|
|
150
|
+
borderRadius,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
// RN: recomendação prática
|
|
154
|
+
return {
|
|
155
|
+
borderWidth: (0, types_1.tok)(t, 'border-width-focus'),
|
|
156
|
+
borderColor: (0, types_1.tok)(t, 'color-focus-ring'),
|
|
157
|
+
borderRadius,
|
|
158
|
+
// um “glow” leve com base no shadow token (se quiseres)
|
|
159
|
+
...(0, exports.resolveShadow)(t, 'native', 'shadow-level-2'),
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
exports.getFocusRingSx = getFocusRingSx;
|
|
163
|
+
/**
|
|
164
|
+
* Sugestão de aplicação:
|
|
165
|
+
* - envolver o componente num wrapper quando focusVisible/focused
|
|
166
|
+
* - wrapper recebe getFocusRingSx(...), e dentro um padding = focus-ring-gap (se quiseres)
|
|
167
|
+
*/
|
|
168
|
+
const getFocusWrapperSx = (t, platform, opts) => ({
|
|
169
|
+
padding: (0, exports.getFocusRingGap)(t, platform),
|
|
170
|
+
borderRadius: opts?.borderRadius,
|
|
171
|
+
});
|
|
172
|
+
exports.getFocusWrapperSx = getFocusWrapperSx;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./helpers"), exports);
|
|
18
|
+
__exportStar(require("./styles"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAvatarParts = void 0;
|
|
4
|
+
// styles/avatars.ts
|
|
5
|
+
const tokens_1 = require("../types/tokens");
|
|
6
|
+
const sizeMap = (t) => ({
|
|
7
|
+
xs: {
|
|
8
|
+
size: (0, tokens_1.tok)(t, 'space-5'),
|
|
9
|
+
font: (0, tokens_1.tok)(t, 'typography-font-size-1'),
|
|
10
|
+
}, // 24 / 12
|
|
11
|
+
sm: {
|
|
12
|
+
size: (0, tokens_1.tok)(t, 'space-6'),
|
|
13
|
+
font: (0, tokens_1.tok)(t, 'typography-font-size-2'),
|
|
14
|
+
}, // 32 / 14
|
|
15
|
+
md: {
|
|
16
|
+
size: (0, tokens_1.tok)(t, 'space-7'),
|
|
17
|
+
font: (0, tokens_1.tok)(t, 'typography-font-size-3'),
|
|
18
|
+
}, // 40 / 16
|
|
19
|
+
lg: {
|
|
20
|
+
size: (0, tokens_1.tok)(t, 'space-8'),
|
|
21
|
+
font: (0, tokens_1.tok)(t, 'typography-font-size-4'),
|
|
22
|
+
}, // sem token exato (P3 ok)
|
|
23
|
+
xl: {
|
|
24
|
+
size: (0, tokens_1.tok)(t, 'space-9'),
|
|
25
|
+
font: (0, tokens_1.tok)(t, 'typography-font-size-5'),
|
|
26
|
+
}, // sem token exato (P3 ok)
|
|
27
|
+
});
|
|
28
|
+
const getAvatarParts = (t, size = 'md') => {
|
|
29
|
+
const s = sizeMap(t)[size];
|
|
30
|
+
return {
|
|
31
|
+
container: {
|
|
32
|
+
width: s.size,
|
|
33
|
+
height: s.size,
|
|
34
|
+
borderRadius: (0, tokens_1.tok)(t, 'radius-full'),
|
|
35
|
+
backgroundColor: (0, tokens_1.tok)(t, 'color-surface-alt'),
|
|
36
|
+
borderWidth: (0, tokens_1.tok)(t, 'border-width-default'),
|
|
37
|
+
borderColor: (0, tokens_1.tok)(t, 'color-border-subtle'),
|
|
38
|
+
alignItems: 'center',
|
|
39
|
+
justifyContent: 'center',
|
|
40
|
+
overflow: 'hidden',
|
|
41
|
+
},
|
|
42
|
+
image: { width: '100%', height: '100%' },
|
|
43
|
+
initials: {
|
|
44
|
+
color: (0, tokens_1.tok)(t, 'color-fg-default'),
|
|
45
|
+
fontFamily: (0, tokens_1.tok)(t, 'typography-font-family-base'),
|
|
46
|
+
fontSize: s.font,
|
|
47
|
+
fontWeight: (0, tokens_1.tok)(t, 'typography-font-weight-strong'),
|
|
48
|
+
lineHeight: (0, tokens_1.tok)(t, 'typography-line-height-tight'),
|
|
49
|
+
},
|
|
50
|
+
statusDot: {
|
|
51
|
+
position: 'absolute',
|
|
52
|
+
right: (0, tokens_1.tok)(t, 'space-1'),
|
|
53
|
+
bottom: (0, tokens_1.tok)(t, 'space-1'),
|
|
54
|
+
width: (0, tokens_1.tok)(t, 'space-2'),
|
|
55
|
+
height: (0, tokens_1.tok)(t, 'space-2'),
|
|
56
|
+
borderRadius: (0, tokens_1.tok)(t, 'radius-full'),
|
|
57
|
+
backgroundColor: (0, tokens_1.tok)(t, 'color-status-success'),
|
|
58
|
+
borderWidth: (0, tokens_1.tok)(t, 'border-width-default'),
|
|
59
|
+
borderColor: (0, tokens_1.tok)(t, 'color-surface'),
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
exports.getAvatarParts = getAvatarParts;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBadgeParts = void 0;
|
|
4
|
+
// styles/badges.ts
|
|
5
|
+
const tokens_1 = require("../types/tokens");
|
|
6
|
+
const getBadgeParts = (t, variant = 'neutral') => {
|
|
7
|
+
const map = {
|
|
8
|
+
neutral: {
|
|
9
|
+
bg: (0, tokens_1.tok)(t, 'color-surface-alt'),
|
|
10
|
+
fg: (0, tokens_1.tok)(t, 'color-fg-default'),
|
|
11
|
+
border: (0, tokens_1.tok)(t, 'color-border-subtle'),
|
|
12
|
+
},
|
|
13
|
+
brand: {
|
|
14
|
+
bg: (0, tokens_1.tok)(t, 'color-brand'),
|
|
15
|
+
fg: (0, tokens_1.tok)(t, 'color-fg-on-inverted'),
|
|
16
|
+
border: (0, tokens_1.tok)(t, 'color-brand'),
|
|
17
|
+
},
|
|
18
|
+
success: {
|
|
19
|
+
bg: (0, tokens_1.tok)(t, 'color-status-success'),
|
|
20
|
+
fg: (0, tokens_1.tok)(t, 'color-status-success-fg'),
|
|
21
|
+
border: (0, tokens_1.tok)(t, 'color-status-success'),
|
|
22
|
+
},
|
|
23
|
+
warning: {
|
|
24
|
+
bg: (0, tokens_1.tok)(t, 'color-status-warning'),
|
|
25
|
+
fg: (0, tokens_1.tok)(t, 'color-status-warning-fg'),
|
|
26
|
+
border: (0, tokens_1.tok)(t, 'color-status-warning'),
|
|
27
|
+
},
|
|
28
|
+
error: {
|
|
29
|
+
bg: (0, tokens_1.tok)(t, 'color-status-error'),
|
|
30
|
+
fg: (0, tokens_1.tok)(t, 'color-status-error-fg'),
|
|
31
|
+
border: (0, tokens_1.tok)(t, 'color-status-error'),
|
|
32
|
+
},
|
|
33
|
+
info: {
|
|
34
|
+
bg: (0, tokens_1.tok)(t, 'color-status-info'),
|
|
35
|
+
fg: (0, tokens_1.tok)(t, 'color-status-info-fg'),
|
|
36
|
+
border: (0, tokens_1.tok)(t, 'color-status-info'),
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
const v = map[variant];
|
|
40
|
+
return {
|
|
41
|
+
container: {
|
|
42
|
+
alignSelf: 'flex-start',
|
|
43
|
+
backgroundColor: v.bg,
|
|
44
|
+
borderColor: v.border,
|
|
45
|
+
borderWidth: (0, tokens_1.tok)(t, 'border-width-default'),
|
|
46
|
+
borderRadius: (0, tokens_1.tok)(t, 'radius-full'),
|
|
47
|
+
paddingVertical: (0, tokens_1.tok)(t, 'space-1'),
|
|
48
|
+
paddingHorizontal: (0, tokens_1.tok)(t, 'space-2'),
|
|
49
|
+
},
|
|
50
|
+
label: {
|
|
51
|
+
color: v.fg,
|
|
52
|
+
fontFamily: (0, tokens_1.tok)(t, 'typography-font-family-base'),
|
|
53
|
+
fontSize: (0, tokens_1.tok)(t, 'typography-font-size-1'),
|
|
54
|
+
fontWeight: (0, tokens_1.tok)(t, 'typography-font-weight-medium'),
|
|
55
|
+
lineHeight: (0, tokens_1.tok)(t, 'typography-line-height-default'),
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
exports.getBadgeParts = getBadgeParts;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBottomSheetParts = void 0;
|
|
4
|
+
// styles/bottomSheets.ts
|
|
5
|
+
const tokens_1 = require("../types/tokens");
|
|
6
|
+
const getBottomSheetParts = (t, opts) => {
|
|
7
|
+
const enter = (0, tokens_1.motion)(t, 'motion-emphasis-enter');
|
|
8
|
+
const exit = (0, tokens_1.motion)(t, 'motion-emphasis-exit');
|
|
9
|
+
const base = {
|
|
10
|
+
backdrop: {
|
|
11
|
+
position: 'absolute',
|
|
12
|
+
inset: 0,
|
|
13
|
+
backgroundColor: (0, tokens_1.tok)(t, 'color-overlay-backdrop'),
|
|
14
|
+
zIndex: (0, tokens_1.tok)(t, 'z-index-layer-overlay'),
|
|
15
|
+
},
|
|
16
|
+
container: {
|
|
17
|
+
position: 'absolute',
|
|
18
|
+
inset: 0,
|
|
19
|
+
justifyContent: 'flex-end',
|
|
20
|
+
zIndex: (0, tokens_1.tok)(t, 'z-index-layer-modal'),
|
|
21
|
+
},
|
|
22
|
+
surface: {
|
|
23
|
+
backgroundColor: (0, tokens_1.tok)(t, 'color-surface'),
|
|
24
|
+
borderTopLeftRadius: (0, tokens_1.tok)(t, 'radius-4'),
|
|
25
|
+
borderTopRightRadius: (0, tokens_1.tok)(t, 'radius-4'),
|
|
26
|
+
borderWidth: (0, tokens_1.tok)(t, 'border-width-default'),
|
|
27
|
+
borderColor: (0, tokens_1.tok)(t, 'color-border-subtle'),
|
|
28
|
+
shadow: (0, tokens_1.tok)(t, 'shadow-level-4'),
|
|
29
|
+
paddingBottom: (0, tokens_1.tok)(t, 'space-4'),
|
|
30
|
+
overflow: 'hidden',
|
|
31
|
+
// semântico (runtime anima slide-up/down)
|
|
32
|
+
animationEnterDurationMs: enter.durationMs,
|
|
33
|
+
animationEnterEasing: enter.easing,
|
|
34
|
+
animationExitDurationMs: exit.durationMs,
|
|
35
|
+
animationExitEasing: exit.easing,
|
|
36
|
+
},
|
|
37
|
+
handle: {
|
|
38
|
+
alignSelf: 'center',
|
|
39
|
+
width: (0, tokens_1.tok)(t, 'space-6'),
|
|
40
|
+
height: (0, tokens_1.tok)(t, 'space-1'),
|
|
41
|
+
borderRadius: (0, tokens_1.tok)(t, 'radius-full'),
|
|
42
|
+
backgroundColor: (0, tokens_1.tok)(t, 'color-border-subtle'),
|
|
43
|
+
marginTop: (0, tokens_1.tok)(t, 'space-2'),
|
|
44
|
+
marginBottom: (0, tokens_1.tok)(t, 'space-2'),
|
|
45
|
+
},
|
|
46
|
+
header: {
|
|
47
|
+
paddingHorizontal: (0, tokens_1.tok)(t, 'space-4'),
|
|
48
|
+
paddingBottom: (0, tokens_1.tok)(t, 'space-2'),
|
|
49
|
+
},
|
|
50
|
+
body: {
|
|
51
|
+
paddingHorizontal: (0, tokens_1.tok)(t, 'space-4'),
|
|
52
|
+
paddingVertical: (0, tokens_1.tok)(t, 'space-3'),
|
|
53
|
+
},
|
|
54
|
+
footer: {
|
|
55
|
+
paddingHorizontal: (0, tokens_1.tok)(t, 'space-4'),
|
|
56
|
+
paddingTop: (0, tokens_1.tok)(t, 'space-2'),
|
|
57
|
+
gap: (0, tokens_1.tok)(t, 'space-2'),
|
|
58
|
+
},
|
|
59
|
+
title: {
|
|
60
|
+
color: (0, tokens_1.tok)(t, 'color-fg-default'),
|
|
61
|
+
fontFamily: (0, tokens_1.tok)(t, 'typography-font-family-heading'),
|
|
62
|
+
fontSize: (0, tokens_1.tok)(t, 'typography-font-size-4'),
|
|
63
|
+
fontWeight: (0, tokens_1.tok)(t, 'typography-font-weight-strong'),
|
|
64
|
+
lineHeight: (0, tokens_1.tok)(t, 'typography-line-height-tight'),
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
if (!opts?.dense)
|
|
68
|
+
return base;
|
|
69
|
+
return {
|
|
70
|
+
...base,
|
|
71
|
+
header: (0, tokens_1.merge)(base.header, { paddingHorizontal: (0, tokens_1.tok)(t, 'space-3') }),
|
|
72
|
+
body: (0, tokens_1.merge)(base.body, { paddingHorizontal: (0, tokens_1.tok)(t, 'space-3') }),
|
|
73
|
+
footer: (0, tokens_1.merge)(base.footer, { paddingHorizontal: (0, tokens_1.tok)(t, 'space-3') }),
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
exports.getBottomSheetParts = getBottomSheetParts;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getButtonParts = void 0;
|
|
4
|
+
// styles/buttons.ts
|
|
5
|
+
const tokens_1 = require("../types/tokens");
|
|
6
|
+
const variantStyles = (t) => ({
|
|
7
|
+
primary: {
|
|
8
|
+
container: {
|
|
9
|
+
backgroundColor: (0, tokens_1.tok)(t, 'color-action-primary'),
|
|
10
|
+
borderColor: 'transparent',
|
|
11
|
+
},
|
|
12
|
+
label: { color: (0, tokens_1.tok)(t, 'color-action-primary-fg') },
|
|
13
|
+
},
|
|
14
|
+
secondary: {
|
|
15
|
+
container: {
|
|
16
|
+
backgroundColor: (0, tokens_1.tok)(t, 'color-action-secondary'),
|
|
17
|
+
borderColor: 'transparent',
|
|
18
|
+
},
|
|
19
|
+
label: { color: (0, tokens_1.tok)(t, 'color-action-secondary-fg') },
|
|
20
|
+
},
|
|
21
|
+
ghost: {
|
|
22
|
+
container: {
|
|
23
|
+
backgroundColor: 'transparent',
|
|
24
|
+
borderColor: (0, tokens_1.tok)(t, 'color-border-subtle'),
|
|
25
|
+
},
|
|
26
|
+
label: { color: (0, tokens_1.tok)(t, 'color-fg-default') },
|
|
27
|
+
},
|
|
28
|
+
danger: {
|
|
29
|
+
container: {
|
|
30
|
+
backgroundColor: (0, tokens_1.tok)(t, 'color-status-error'),
|
|
31
|
+
borderColor: 'transparent',
|
|
32
|
+
},
|
|
33
|
+
label: { color: (0, tokens_1.tok)(t, 'color-status-error-fg') },
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
const sizeStyles = (t) => ({
|
|
37
|
+
sm: {
|
|
38
|
+
container: {
|
|
39
|
+
minHeight: (0, tokens_1.tok)(t, 'tap-target-min'),
|
|
40
|
+
paddingHorizontal: (0, tokens_1.tok)(t, 'space-3'),
|
|
41
|
+
paddingVertical: (0, tokens_1.tok)(t, 'space-2'),
|
|
42
|
+
},
|
|
43
|
+
label: {
|
|
44
|
+
fontSize: (0, tokens_1.tok)(t, 'typography-font-size-2'),
|
|
45
|
+
},
|
|
46
|
+
icon: {
|
|
47
|
+
width: (0, tokens_1.tok)(t, 'typography-font-size-4'),
|
|
48
|
+
height: (0, tokens_1.tok)(t, 'typography-font-size-4'),
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
md: {
|
|
52
|
+
container: {
|
|
53
|
+
minHeight: (0, tokens_1.tok)(t, 'tap-target-min'),
|
|
54
|
+
paddingHorizontal: (0, tokens_1.tok)(t, 'space-4'),
|
|
55
|
+
paddingVertical: (0, tokens_1.tok)(t, 'space-2'),
|
|
56
|
+
},
|
|
57
|
+
label: {
|
|
58
|
+
fontSize: (0, tokens_1.tok)(t, 'typography-font-size-3'),
|
|
59
|
+
},
|
|
60
|
+
icon: {
|
|
61
|
+
width: (0, tokens_1.tok)(t, 'typography-font-size-4'),
|
|
62
|
+
height: (0, tokens_1.tok)(t, 'typography-font-size-4'),
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
lg: {
|
|
66
|
+
container: {
|
|
67
|
+
minHeight: (0, tokens_1.tok)(t, 'tap-target-min'),
|
|
68
|
+
paddingHorizontal: (0, tokens_1.tok)(t, 'space-5'),
|
|
69
|
+
paddingVertical: (0, tokens_1.tok)(t, 'space-3'),
|
|
70
|
+
},
|
|
71
|
+
label: {
|
|
72
|
+
fontSize: (0, tokens_1.tok)(t, 'typography-font-size-4'),
|
|
73
|
+
},
|
|
74
|
+
icon: {
|
|
75
|
+
width: (0, tokens_1.tok)(t, 'typography-font-size-5'),
|
|
76
|
+
height: (0, tokens_1.tok)(t, 'typography-font-size-5'),
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
const getButtonParts = (t, opts = {}) => {
|
|
81
|
+
const variant = opts.variant ?? 'primary';
|
|
82
|
+
const size = opts.size ?? 'md';
|
|
83
|
+
const isDisabled = Boolean(opts.disabled || opts.loading);
|
|
84
|
+
const baseContainer = {
|
|
85
|
+
borderWidth: (0, tokens_1.tok)(t, 'border-width-default'),
|
|
86
|
+
borderRadius: (0, tokens_1.tok)(t, 'radius-3'),
|
|
87
|
+
alignItems: 'center',
|
|
88
|
+
justifyContent: 'center',
|
|
89
|
+
flexDirection: 'row',
|
|
90
|
+
gap: (0, tokens_1.tok)(t, 'space-2'),
|
|
91
|
+
};
|
|
92
|
+
const baseLabel = {
|
|
93
|
+
fontFamily: (0, tokens_1.tok)(t, 'typography-font-family-base'),
|
|
94
|
+
fontWeight: (0, tokens_1.tok)(t, 'typography-font-weight-medium'),
|
|
95
|
+
lineHeight: (0, tokens_1.tok)(t, 'typography-line-height-default'),
|
|
96
|
+
};
|
|
97
|
+
const focusRing = {
|
|
98
|
+
outlineStyle: 'solid',
|
|
99
|
+
outlineWidth: (0, tokens_1.tok)(t, 'border-width-focus'),
|
|
100
|
+
outlineColor: (0, tokens_1.tok)(t, 'color-focus-ring'),
|
|
101
|
+
outlineOffset: (0, tokens_1.tok)(t, 'focus-ring-gap'),
|
|
102
|
+
};
|
|
103
|
+
const disabledStyles = {
|
|
104
|
+
container: {
|
|
105
|
+
backgroundColor: (0, tokens_1.tok)(t, 'color-state-disabled-bg'),
|
|
106
|
+
borderColor: (0, tokens_1.tok)(t, 'color-state-disabled-bg'),
|
|
107
|
+
opacity: (0, tokens_1.tok)(t, 'opacity-disabled'),
|
|
108
|
+
},
|
|
109
|
+
label: { color: (0, tokens_1.tok)(t, 'color-state-disabled-fg') },
|
|
110
|
+
};
|
|
111
|
+
const interaction = {
|
|
112
|
+
hovered: { container: { opacity: 0.96 } },
|
|
113
|
+
pressed: { container: { opacity: (0, tokens_1.tok)(t, 'opacity-pressed') } },
|
|
114
|
+
fullWidth: { container: { alignSelf: 'stretch' } },
|
|
115
|
+
};
|
|
116
|
+
const v = variantStyles(t)[variant];
|
|
117
|
+
const s = sizeStyles(t)[size];
|
|
118
|
+
return {
|
|
119
|
+
container: (0, tokens_1.merge)(baseContainer, s.container, v.container, opts.fullWidth && interaction.fullWidth.container, opts.hovered && interaction.hovered.container, opts.pressed && interaction.pressed.container, isDisabled && disabledStyles.container),
|
|
120
|
+
label: (0, tokens_1.merge)(baseLabel, s.label, v.label, isDisabled && disabledStyles.label),
|
|
121
|
+
icon: (0, tokens_1.merge)(s.icon, {
|
|
122
|
+
color: (isDisabled
|
|
123
|
+
? disabledStyles.label.color
|
|
124
|
+
: v.label.color),
|
|
125
|
+
}),
|
|
126
|
+
focusRing: (0, tokens_1.merge)(opts.focusVisible ? focusRing : undefined),
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
exports.getButtonParts = getButtonParts;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCardParts = void 0;
|
|
4
|
+
// styles/cards.ts
|
|
5
|
+
const tokens_1 = require("../types/tokens");
|
|
6
|
+
const variantStyles = (t) => ({
|
|
7
|
+
default: {
|
|
8
|
+
container: {
|
|
9
|
+
backgroundColor: (0, tokens_1.tok)(t, 'color-surface'),
|
|
10
|
+
borderColor: (0, tokens_1.tok)(t, 'color-border-subtle'),
|
|
11
|
+
shadow: (0, tokens_1.tok)(t, 'shadow-level-1'),
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
elevated: {
|
|
15
|
+
container: {
|
|
16
|
+
backgroundColor: (0, tokens_1.tok)(t, 'color-surface'),
|
|
17
|
+
borderColor: (0, tokens_1.tok)(t, 'color-border-subtle'),
|
|
18
|
+
shadow: (0, tokens_1.tok)(t, 'shadow-level-2'),
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
outlined: {
|
|
22
|
+
container: {
|
|
23
|
+
backgroundColor: (0, tokens_1.tok)(t, 'color-surface'),
|
|
24
|
+
borderColor: (0, tokens_1.tok)(t, 'color-border-strong'),
|
|
25
|
+
shadow: 'none',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
subtle: {
|
|
29
|
+
container: {
|
|
30
|
+
backgroundColor: (0, tokens_1.tok)(t, 'color-surface-alt'),
|
|
31
|
+
borderColor: (0, tokens_1.tok)(t, 'color-border-subtle'),
|
|
32
|
+
shadow: 'none',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
const getCardParts = (t, opts = {}) => {
|
|
37
|
+
const variant = opts.variant ?? 'default';
|
|
38
|
+
const v = variantStyles(t)[variant];
|
|
39
|
+
const baseContainer = {
|
|
40
|
+
borderWidth: (0, tokens_1.tok)(t, 'border-width-default'),
|
|
41
|
+
borderRadius: (0, tokens_1.tok)(t, 'radius-3'),
|
|
42
|
+
padding: (0, tokens_1.tok)(t, 'space-4'),
|
|
43
|
+
};
|
|
44
|
+
const hover = { shadow: (0, tokens_1.tok)(t, 'shadow-level-3') };
|
|
45
|
+
const pressed = {
|
|
46
|
+
opacity: (0, tokens_1.tok)(t, 'opacity-pressed'),
|
|
47
|
+
shadow: (0, tokens_1.tok)(t, 'shadow-level-2'),
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
container: (0, tokens_1.merge)(baseContainer, v.container, opts.hovered && hover, opts.pressed && pressed),
|
|
51
|
+
header: { marginBottom: (0, tokens_1.tok)(t, 'space-3') },
|
|
52
|
+
body: {},
|
|
53
|
+
footer: { marginTop: (0, tokens_1.tok)(t, 'space-3') },
|
|
54
|
+
title: {
|
|
55
|
+
color: (0, tokens_1.tok)(t, 'color-fg-default'),
|
|
56
|
+
fontFamily: (0, tokens_1.tok)(t, 'typography-font-family-heading'),
|
|
57
|
+
fontSize: (0, tokens_1.tok)(t, 'typography-font-size-4'),
|
|
58
|
+
fontWeight: (0, tokens_1.tok)(t, 'typography-font-weight-strong'),
|
|
59
|
+
lineHeight: (0, tokens_1.tok)(t, 'typography-line-height-tight'),
|
|
60
|
+
},
|
|
61
|
+
subtitle: {
|
|
62
|
+
marginTop: (0, tokens_1.tok)(t, 'space-1'),
|
|
63
|
+
color: (0, tokens_1.tok)(t, 'color-fg-muted'),
|
|
64
|
+
fontFamily: (0, tokens_1.tok)(t, 'typography-font-family-base'),
|
|
65
|
+
fontSize: (0, tokens_1.tok)(t, 'typography-font-size-3'),
|
|
66
|
+
fontWeight: (0, tokens_1.tok)(t, 'typography-font-weight-regular'),
|
|
67
|
+
lineHeight: (0, tokens_1.tok)(t, 'typography-line-height-default'),
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
exports.getCardParts = getCardParts;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getCheckboxParts = void 0;
|
|
4
|
+
// styles/checkboxes.ts
|
|
5
|
+
const tokens_1 = require("../types/tokens");
|
|
6
|
+
const getCheckboxParts = (t, s = {}) => {
|
|
7
|
+
const isOn = Boolean(s.checked || s.indeterminate);
|
|
8
|
+
const isDisabled = Boolean(s.disabled);
|
|
9
|
+
const wrapper = {
|
|
10
|
+
minHeight: (0, tokens_1.tok)(t, 'tap-target-min'),
|
|
11
|
+
paddingVertical: (0, tokens_1.tok)(t, 'space-2'),
|
|
12
|
+
paddingHorizontal: (0, tokens_1.tok)(t, 'space-2'),
|
|
13
|
+
flexDirection: 'row',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
gap: (0, tokens_1.tok)(t, 'space-2'),
|
|
16
|
+
};
|
|
17
|
+
const boxBase = {
|
|
18
|
+
width: (0, tokens_1.tok)(t, 'typography-font-size-5'),
|
|
19
|
+
height: (0, tokens_1.tok)(t, 'typography-font-size-5'),
|
|
20
|
+
borderRadius: (0, tokens_1.tok)(t, 'radius-2'),
|
|
21
|
+
borderWidth: (0, tokens_1.tok)(t, 'border-width-default'),
|
|
22
|
+
backgroundColor: (0, tokens_1.tok)(t, 'color-surface'),
|
|
23
|
+
borderColor: (0, tokens_1.tok)(t, 'color-border-strong'),
|
|
24
|
+
alignItems: 'center',
|
|
25
|
+
justifyContent: 'center',
|
|
26
|
+
};
|
|
27
|
+
const boxOn = {
|
|
28
|
+
backgroundColor: (0, tokens_1.tok)(t, 'color-accent'),
|
|
29
|
+
borderColor: (0, tokens_1.tok)(t, 'color-accent'),
|
|
30
|
+
};
|
|
31
|
+
const boxDisabled = {
|
|
32
|
+
backgroundColor: (0, tokens_1.tok)(t, 'color-state-disabled-bg'),
|
|
33
|
+
borderColor: (0, tokens_1.tok)(t, 'color-state-disabled-bg'),
|
|
34
|
+
};
|
|
35
|
+
const checkmark = {
|
|
36
|
+
color: isDisabled
|
|
37
|
+
? (0, tokens_1.tok)(t, 'color-state-disabled-fg')
|
|
38
|
+
: (0, tokens_1.tok)(t, 'color-accent-fg'),
|
|
39
|
+
width: (0, tokens_1.tok)(t, 'typography-font-size-4'),
|
|
40
|
+
height: (0, tokens_1.tok)(t, 'typography-font-size-4'),
|
|
41
|
+
};
|
|
42
|
+
const label = {
|
|
43
|
+
color: isDisabled
|
|
44
|
+
? (0, tokens_1.tok)(t, 'color-state-disabled-fg')
|
|
45
|
+
: (0, tokens_1.tok)(t, 'color-fg-default'),
|
|
46
|
+
fontFamily: (0, tokens_1.tok)(t, 'typography-font-family-base'),
|
|
47
|
+
fontSize: (0, tokens_1.tok)(t, 'typography-font-size-3'),
|
|
48
|
+
lineHeight: (0, tokens_1.tok)(t, 'typography-line-height-default'),
|
|
49
|
+
fontWeight: (0, tokens_1.tok)(t, 'typography-font-weight-regular'),
|
|
50
|
+
};
|
|
51
|
+
const focusRing = {
|
|
52
|
+
outlineStyle: 'solid',
|
|
53
|
+
outlineWidth: (0, tokens_1.tok)(t, 'border-width-focus'),
|
|
54
|
+
outlineColor: (0, tokens_1.tok)(t, 'color-focus-ring'),
|
|
55
|
+
outlineOffset: (0, tokens_1.tok)(t, 'focus-ring-gap'),
|
|
56
|
+
};
|
|
57
|
+
const interaction = s.pressed
|
|
58
|
+
? { opacity: (0, tokens_1.tok)(t, 'opacity-pressed') }
|
|
59
|
+
: s.hovered
|
|
60
|
+
? { opacity: 0.96 }
|
|
61
|
+
: {};
|
|
62
|
+
return {
|
|
63
|
+
wrapper: (0, tokens_1.merge)(wrapper, interaction),
|
|
64
|
+
box: (0, tokens_1.merge)(boxBase, isOn && boxOn, isDisabled && boxDisabled),
|
|
65
|
+
checkmark: (0, tokens_1.merge)(checkmark),
|
|
66
|
+
label: (0, tokens_1.merge)(label),
|
|
67
|
+
focusRing: (0, tokens_1.merge)(s.focusVisible ? focusRing : undefined),
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
exports.getCheckboxParts = getCheckboxParts;
|