@travelallfly/ui 0.0.0-stage → 0.1.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/README.md +157 -2
- package/dist/chunk-55LHKHCP.js +225 -0
- package/dist/chunk-6FRP4Q2K.js +109 -0
- package/dist/chunk-LGGVSGQF.cjs +225 -0
- package/dist/chunk-NRXCNNTQ.cjs +109 -0
- package/dist/index.cjs +205 -0
- package/dist/index.d.cts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +169 -0
- package/dist/tailwind-preset.cjs +62 -0
- package/dist/tailwind-preset.d.cts +23 -0
- package/dist/tailwind-preset.d.ts +23 -0
- package/dist/tailwind-preset.js +60 -0
- package/dist/tokens.cjs +54 -0
- package/dist/tokens.css +167 -0
- package/dist/tokens.d.cts +410 -0
- package/dist/tokens.d.ts +410 -0
- package/dist/tokens.js +54 -0
- package/dist/utils.cjs +74 -0
- package/dist/utils.d.cts +13 -0
- package/dist/utils.d.ts +13 -0
- package/dist/utils.js +74 -0
- package/package.json +115 -4
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/tokens/tokens.ts
|
|
2
|
+
var primitives = {
|
|
3
|
+
base: {
|
|
4
|
+
white: "#FFFFFF"
|
|
5
|
+
},
|
|
6
|
+
blue: {
|
|
7
|
+
50: "#EAF3FF",
|
|
8
|
+
100: "#C9D6EE",
|
|
9
|
+
200: "#9CC4F8",
|
|
10
|
+
300: "#7DB4F5",
|
|
11
|
+
500: "#0770E3",
|
|
12
|
+
600: "#055BBD",
|
|
13
|
+
700: "#0A4794",
|
|
14
|
+
900: "#0B1F4B"
|
|
15
|
+
},
|
|
16
|
+
warm: {
|
|
17
|
+
0: "#FFFEFC",
|
|
18
|
+
50: "#FBF8F3",
|
|
19
|
+
75: "#F7F3EC",
|
|
20
|
+
100: "#F3EEE6",
|
|
21
|
+
200: "#E7E0D5",
|
|
22
|
+
300: "#CFC6B8",
|
|
23
|
+
400: "#A39A8C",
|
|
24
|
+
600: "#6B655C",
|
|
25
|
+
800: "#4A453E",
|
|
26
|
+
900: "#1F1D1A"
|
|
27
|
+
},
|
|
28
|
+
sunrise: {
|
|
29
|
+
50: "#FDEBE4",
|
|
30
|
+
500: "#E8603C",
|
|
31
|
+
700: "#B5411F"
|
|
32
|
+
},
|
|
33
|
+
marigold: {
|
|
34
|
+
50: "#FDF3DC",
|
|
35
|
+
100: "#FCEBB6",
|
|
36
|
+
500: "#F2B035",
|
|
37
|
+
800: "#7A4E00",
|
|
38
|
+
900: "#4A3000"
|
|
39
|
+
},
|
|
40
|
+
palm: {
|
|
41
|
+
50: "#E3F4EE",
|
|
42
|
+
500: "#1A7A5E",
|
|
43
|
+
700: "#14664F"
|
|
44
|
+
},
|
|
45
|
+
red: {
|
|
46
|
+
50: "#FBE9E7",
|
|
47
|
+
500: "#C93A3A",
|
|
48
|
+
700: "#A12B2B",
|
|
49
|
+
900: "#7A1F1F"
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var colorRoles = {
|
|
53
|
+
bg: {
|
|
54
|
+
page: "warm/50",
|
|
55
|
+
surface: "warm/0",
|
|
56
|
+
sunken: "warm/100",
|
|
57
|
+
hover: "warm/75",
|
|
58
|
+
selected: "blue/50",
|
|
59
|
+
feature: "blue/900",
|
|
60
|
+
action: "blue/500",
|
|
61
|
+
"action-hover": "blue/600",
|
|
62
|
+
"action-pressed": "blue/700",
|
|
63
|
+
inverse: "warm/900",
|
|
64
|
+
scrim: "warm/900@60"
|
|
65
|
+
},
|
|
66
|
+
text: {
|
|
67
|
+
primary: "warm/900",
|
|
68
|
+
secondary: "warm/800",
|
|
69
|
+
muted: "warm/600",
|
|
70
|
+
link: "blue/600",
|
|
71
|
+
"on-action": "base/white",
|
|
72
|
+
"on-feature": "base/white",
|
|
73
|
+
"on-feature-muted": "blue/100",
|
|
74
|
+
"on-selected": "blue/700",
|
|
75
|
+
inverse: "warm/0"
|
|
76
|
+
},
|
|
77
|
+
border: {
|
|
78
|
+
default: "warm/200",
|
|
79
|
+
strong: "warm/300",
|
|
80
|
+
control: "warm/400",
|
|
81
|
+
focus: "blue/500",
|
|
82
|
+
selected: "blue/500",
|
|
83
|
+
ink: "warm/900"
|
|
84
|
+
},
|
|
85
|
+
status: {
|
|
86
|
+
success: { fill: "palm/50", text: "palm/700", border: "palm/500" },
|
|
87
|
+
info: { fill: "blue/50", text: "blue/700", border: "blue/200" },
|
|
88
|
+
caution: { fill: "marigold/100", text: "marigold/900", icon: "marigold/800", border: "marigold/500" },
|
|
89
|
+
error: { fill: "red/50", text: "red/900", strong: "red/700", border: "red/500" },
|
|
90
|
+
neutral: { fill: "warm/100", text: "warm/800", border: "warm/300" }
|
|
91
|
+
},
|
|
92
|
+
travel: {
|
|
93
|
+
flights: { tint: "blue/50", ink: "blue/700", accent: "blue/500" },
|
|
94
|
+
hotels: { tint: "sunrise/50", ink: "sunrise/700", accent: "sunrise/500" },
|
|
95
|
+
cars: { tint: "marigold/50", ink: "marigold/800", accent: "marigold/500" },
|
|
96
|
+
rail: { tint: "palm/50", ink: "palm/700", accent: "palm/500" }
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
var colorRolesDark = {
|
|
100
|
+
bg: {
|
|
101
|
+
page: "#151310",
|
|
102
|
+
surface: "warm/900",
|
|
103
|
+
sunken: "#2A2723",
|
|
104
|
+
hover: "#26231F",
|
|
105
|
+
selected: "#172A45",
|
|
106
|
+
feature: "blue/900",
|
|
107
|
+
action: "blue/500",
|
|
108
|
+
"action-hover": "blue/600",
|
|
109
|
+
"action-pressed": "blue/700",
|
|
110
|
+
inverse: "warm/100",
|
|
111
|
+
scrim: "warm/900@60"
|
|
112
|
+
},
|
|
113
|
+
text: {
|
|
114
|
+
primary: "warm/100",
|
|
115
|
+
secondary: "#D4CBBE",
|
|
116
|
+
muted: "#ABA294",
|
|
117
|
+
link: "blue/300",
|
|
118
|
+
"on-action": "base/white",
|
|
119
|
+
"on-feature": "base/white",
|
|
120
|
+
"on-feature-muted": "blue/100",
|
|
121
|
+
"on-selected": "blue/200",
|
|
122
|
+
inverse: "warm/900"
|
|
123
|
+
},
|
|
124
|
+
border: {
|
|
125
|
+
default: "#38342E",
|
|
126
|
+
strong: "#4F4941",
|
|
127
|
+
control: "#857C70",
|
|
128
|
+
focus: "blue/300",
|
|
129
|
+
selected: "blue/300",
|
|
130
|
+
ink: "warm/100"
|
|
131
|
+
},
|
|
132
|
+
status: {
|
|
133
|
+
success: { fill: "#13291F", text: "#86D3B2", border: "#3DB489" },
|
|
134
|
+
info: { fill: "#15243A", text: "#A9CBF7", border: "#2E4F7C" },
|
|
135
|
+
caution: { fill: "#2D2412", text: "#F5CB78", icon: "marigold/500", border: "#7A5A17" },
|
|
136
|
+
error: { fill: "#341A18", text: "#F6A8A0", strong: "#EE7A70", border: "#8A3530" },
|
|
137
|
+
neutral: { fill: "#2A2723", text: "#D4CBBE", border: "#4F4941" }
|
|
138
|
+
},
|
|
139
|
+
travel: {
|
|
140
|
+
flights: { tint: "#172A45", ink: "blue/200", accent: "blue/500" },
|
|
141
|
+
hotels: { tint: "#33201A", ink: "#F59A7C", accent: "sunrise/500" },
|
|
142
|
+
cars: { tint: "#2D2412", ink: "#F5C46A", accent: "marigold/500" },
|
|
143
|
+
rail: { tint: "#13291F", ink: "#7CCCAD", accent: "palm/500" }
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
var darkRolesUnverified = [
|
|
147
|
+
"bg/scrim",
|
|
148
|
+
"border/selected",
|
|
149
|
+
"travel/flights/accent",
|
|
150
|
+
"travel/hotels/accent",
|
|
151
|
+
"travel/cars/accent",
|
|
152
|
+
"travel/rail/accent"
|
|
153
|
+
];
|
|
154
|
+
var spacing = {
|
|
155
|
+
xs: 4,
|
|
156
|
+
sm: 8,
|
|
157
|
+
md: 12,
|
|
158
|
+
lg: 16,
|
|
159
|
+
xl: 24,
|
|
160
|
+
"2xl": 32,
|
|
161
|
+
"3xl": 48,
|
|
162
|
+
"4xl": 64
|
|
163
|
+
};
|
|
164
|
+
var radius = {
|
|
165
|
+
xs: { value: 4, usage: "Checkboxes" },
|
|
166
|
+
sm: { value: 8, usage: "Tooltips, seats" },
|
|
167
|
+
md: { value: 12, usage: "Inputs, nav items" },
|
|
168
|
+
lg: { value: 16, usage: "Banners, toasts" },
|
|
169
|
+
xl: { value: 24, usage: "Cards" },
|
|
170
|
+
"2xl": { value: 32, usage: "Modals" },
|
|
171
|
+
full: { value: 9999, usage: "Buttons, chips" }
|
|
172
|
+
};
|
|
173
|
+
var elevation = {
|
|
174
|
+
raised: {
|
|
175
|
+
value: "0 1px 2px rgba(31, 29, 26, 0.06), 0 4px 12px rgba(31, 29, 26, 0.06)",
|
|
176
|
+
usage: "The booking card, popovers, the selected fare."
|
|
177
|
+
},
|
|
178
|
+
floating: {
|
|
179
|
+
value: "0 2px 6px rgba(31, 29, 26, 0.06), 0 12px 32px rgba(31, 29, 26, 0.14)",
|
|
180
|
+
usage: "Modals, menus and toasts, over the scrim."
|
|
181
|
+
},
|
|
182
|
+
focus: {
|
|
183
|
+
value: "0 0 0 4px color-mix(in srgb, var(--af-bg-action) 30%, transparent)",
|
|
184
|
+
usage: "Every interactive element on keyboard focus."
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
var fonts = {
|
|
188
|
+
ui: ['"Figtree Variable"', "Figtree", "ui-sans-serif", "system-ui", "sans-serif"],
|
|
189
|
+
voice: ['"Instrument Serif"', "ui-serif", "Georgia", "serif"],
|
|
190
|
+
code: ['"Geist Mono Variable"', '"Geist Mono"', "ui-monospace", "SFMono-Regular", "monospace"]
|
|
191
|
+
};
|
|
192
|
+
var typeStyles = {
|
|
193
|
+
display: { font: "ui", size: 40, lineHeight: 44, weight: 600, sample: "Book the 7:05 to LaGuardia" },
|
|
194
|
+
title: { font: "ui", size: 28, lineHeight: 34, weight: 600, sample: "Choose a fare for your round trip" },
|
|
195
|
+
heading: { font: "ui", size: 20, lineHeight: 28, weight: 600, sample: "Returning flights" },
|
|
196
|
+
body: { font: "ui", size: 15, lineHeight: 22, weight: 400, sample: "Arrival airport and dates come from the event." },
|
|
197
|
+
"body-strong": { font: "ui", size: 15, lineHeight: 22, weight: 600, sample: "7:20 AM \u2013 10:01 AM" },
|
|
198
|
+
label: { font: "ui", size: 13, lineHeight: 18, weight: 500, sample: "Delta \xB7 DL 2122" },
|
|
199
|
+
"label-strong": { font: "ui", size: 13, lineHeight: 18, weight: 600, sample: "Booked" },
|
|
200
|
+
eyebrow: {
|
|
201
|
+
font: "ui",
|
|
202
|
+
size: 13,
|
|
203
|
+
lineHeight: 18,
|
|
204
|
+
weight: 600,
|
|
205
|
+
uppercase: true,
|
|
206
|
+
letterSpacing: "0.08em",
|
|
207
|
+
sample: "Flights \xB7 Shopping list"
|
|
208
|
+
},
|
|
209
|
+
voice: { font: "voice", size: 40, lineHeight: 44, weight: 400, italic: true, sample: "Good evening, Kenneth." },
|
|
210
|
+
"voice-sm": { font: "voice", size: 28, lineHeight: 32, weight: 400, italic: true, sample: "You\u2019re all set, Maya." },
|
|
211
|
+
mono: { font: "code", size: 15, lineHeight: 22, weight: 400, sample: "DL 1482 \xB7 GXK4QP \xB7 $1,440.76" },
|
|
212
|
+
"mono-lg": { font: "code", size: 40, lineHeight: 44, weight: 500, sample: "$495,052.00" }
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
exports.primitives = primitives; exports.colorRoles = colorRoles; exports.colorRolesDark = colorRolesDark; exports.darkRolesUnverified = darkRolesUnverified; exports.spacing = spacing; exports.radius = radius; exports.elevation = elevation; exports.fonts = fonts; exports.typeStyles = typeStyles;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkLGGVSGQFcjs = require('./chunk-LGGVSGQF.cjs');
|
|
10
|
+
|
|
11
|
+
// src/tokens/css.ts
|
|
12
|
+
var prefix = "af";
|
|
13
|
+
function flattenRoles(tree, path = []) {
|
|
14
|
+
return Object.entries(tree).flatMap(([key, value]) => {
|
|
15
|
+
const next = [...path, key];
|
|
16
|
+
if (typeof value !== "string") return flattenRoles(value, next);
|
|
17
|
+
return [{ name: next.join("-"), figmaName: next.join("/"), group: next[0], ref: value }];
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
var roles = flattenRoles(_chunkLGGVSGQFcjs.colorRoles);
|
|
21
|
+
var darkRoles = flattenRoles(_chunkLGGVSGQFcjs.colorRolesDark);
|
|
22
|
+
var darkClass = "dark";
|
|
23
|
+
function darkRoleFor(name) {
|
|
24
|
+
const role = darkRoles.find((item) => item.name === name);
|
|
25
|
+
if (!role) throw new Error(`Role "${name}" has no dark value`);
|
|
26
|
+
return role;
|
|
27
|
+
}
|
|
28
|
+
function isHex(ref) {
|
|
29
|
+
return /^#[0-9A-F]{6}$/.test(ref);
|
|
30
|
+
}
|
|
31
|
+
function splitAlpha(ref) {
|
|
32
|
+
const [base, alpha] = ref.split("@");
|
|
33
|
+
if (alpha === void 0) return { base, alpha: null };
|
|
34
|
+
const percent = Number(alpha);
|
|
35
|
+
if (!Number.isInteger(percent) || percent < 1 || percent > 99) throw new Error(`Bad opacity in "${ref}"`);
|
|
36
|
+
return { base, alpha: percent };
|
|
37
|
+
}
|
|
38
|
+
function resolveColor(ref) {
|
|
39
|
+
const { base } = splitAlpha(ref);
|
|
40
|
+
return isHex(base) ? base : resolvePrimitive(base);
|
|
41
|
+
}
|
|
42
|
+
function colorValue(ref) {
|
|
43
|
+
const { base, alpha } = splitAlpha(ref);
|
|
44
|
+
resolveColor(ref);
|
|
45
|
+
const solid = isHex(base) ? base : cssVar(primitiveName(base));
|
|
46
|
+
return alpha === null ? solid : `color-mix(in srgb, ${solid} ${alpha}%, transparent)`;
|
|
47
|
+
}
|
|
48
|
+
function cssVarName(name) {
|
|
49
|
+
return `--${prefix}-${name}`;
|
|
50
|
+
}
|
|
51
|
+
function cssVar(name) {
|
|
52
|
+
return `var(${cssVarName(name)})`;
|
|
53
|
+
}
|
|
54
|
+
function primitiveName(ref) {
|
|
55
|
+
return ref.replace("/", "-");
|
|
56
|
+
}
|
|
57
|
+
function resolvePrimitive(ref) {
|
|
58
|
+
const [scale, step] = ref.split("/");
|
|
59
|
+
const steps = _chunkLGGVSGQFcjs.primitives[scale];
|
|
60
|
+
const value = _optionalChain([steps, 'optionalAccess', _ => _[step]]);
|
|
61
|
+
if (!value) throw new Error(`Unknown primitive "${ref}"`);
|
|
62
|
+
return value;
|
|
63
|
+
}
|
|
64
|
+
function rem(px) {
|
|
65
|
+
return `${px / 16}rem`;
|
|
66
|
+
}
|
|
67
|
+
function renderTokensCss() {
|
|
68
|
+
const groups = [];
|
|
69
|
+
groups.push(
|
|
70
|
+
Object.entries(_chunkLGGVSGQFcjs.primitives).flatMap(
|
|
71
|
+
([scale, steps]) => Object.entries(steps).map(([step, value]) => `${cssVarName(`${scale}-${step}`)}: ${value};`)
|
|
72
|
+
)
|
|
73
|
+
);
|
|
74
|
+
groups.push(roles.map((role) => `${cssVarName(role.name)}: ${colorValue(role.ref)};`));
|
|
75
|
+
groups.push(Object.entries(_chunkLGGVSGQFcjs.spacing).map(([key, px]) => `${cssVarName(`spacing-${key}`)}: ${rem(px)};`));
|
|
76
|
+
groups.push(Object.entries(_chunkLGGVSGQFcjs.radius).map(([key, item]) => `${cssVarName(`radius-${key}`)}: ${item.value}px;`));
|
|
77
|
+
groups.push(Object.entries(_chunkLGGVSGQFcjs.elevation).map(([key, item]) => `${cssVarName(`elevation-${key}`)}: ${item.value};`));
|
|
78
|
+
groups.push(Object.entries(_chunkLGGVSGQFcjs.fonts).map(([key, stack]) => `${cssVarName(`font-${key}`)}: ${stack.join(", ")};`));
|
|
79
|
+
const indent = (lines) => lines.map((line) => ` ${line}`).join("\n");
|
|
80
|
+
const body = [["color-scheme: light;"], ...groups].map(indent).join("\n\n");
|
|
81
|
+
const darkLines = roles.map((role) => ({ light: role, dark: darkRoleFor(role.name) })).filter(({ light, dark }) => light.ref !== dark.ref).map(({ dark }) => `${cssVarName(dark.name)}: ${colorValue(dark.ref)};`);
|
|
82
|
+
const darkBody = [["color-scheme: dark;"], darkLines].map(indent).join("\n\n");
|
|
83
|
+
return `:root {
|
|
84
|
+
${body}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.${darkClass} {
|
|
88
|
+
${darkBody}
|
|
89
|
+
}
|
|
90
|
+
`;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
exports.prefix = prefix; exports.flattenRoles = flattenRoles; exports.roles = roles; exports.darkRoles = darkRoles; exports.darkClass = darkClass; exports.darkRoleFor = darkRoleFor; exports.isHex = isHex; exports.splitAlpha = splitAlpha; exports.resolveColor = resolveColor; exports.cssVarName = cssVarName; exports.cssVar = cssVar; exports.primitiveName = primitiveName; exports.resolvePrimitive = resolvePrimitive; exports.rem = rem; exports.renderTokensCss = renderTokensCss;
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/index.ts
|
|
32
|
+
var src_exports = {};
|
|
33
|
+
__export(src_exports, {
|
|
34
|
+
Button: () => Button
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(src_exports);
|
|
37
|
+
|
|
38
|
+
// src/components/button/button.tsx
|
|
39
|
+
var React = __toESM(require("react"), 1);
|
|
40
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
41
|
+
|
|
42
|
+
// src/lib/cn.ts
|
|
43
|
+
var import_clsx = require("clsx");
|
|
44
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
45
|
+
|
|
46
|
+
// src/tokens/tokens.ts
|
|
47
|
+
var spacing = {
|
|
48
|
+
xs: 4,
|
|
49
|
+
sm: 8,
|
|
50
|
+
md: 12,
|
|
51
|
+
lg: 16,
|
|
52
|
+
xl: 24,
|
|
53
|
+
"2xl": 32,
|
|
54
|
+
"3xl": 48,
|
|
55
|
+
"4xl": 64
|
|
56
|
+
};
|
|
57
|
+
var radius = {
|
|
58
|
+
xs: { value: 4, usage: "Checkboxes" },
|
|
59
|
+
sm: { value: 8, usage: "Tooltips, seats" },
|
|
60
|
+
md: { value: 12, usage: "Inputs, nav items" },
|
|
61
|
+
lg: { value: 16, usage: "Banners, toasts" },
|
|
62
|
+
xl: { value: 24, usage: "Cards" },
|
|
63
|
+
"2xl": { value: 32, usage: "Modals" },
|
|
64
|
+
full: { value: 9999, usage: "Buttons, chips" }
|
|
65
|
+
};
|
|
66
|
+
var elevation = {
|
|
67
|
+
raised: {
|
|
68
|
+
value: "0 1px 2px rgba(31, 29, 26, 0.06), 0 4px 12px rgba(31, 29, 26, 0.06)",
|
|
69
|
+
usage: "The booking card, popovers, the selected fare."
|
|
70
|
+
},
|
|
71
|
+
floating: {
|
|
72
|
+
value: "0 2px 6px rgba(31, 29, 26, 0.06), 0 12px 32px rgba(31, 29, 26, 0.14)",
|
|
73
|
+
usage: "Modals, menus and toasts, over the scrim."
|
|
74
|
+
},
|
|
75
|
+
focus: {
|
|
76
|
+
value: "0 0 0 4px color-mix(in srgb, var(--af-bg-action) 30%, transparent)",
|
|
77
|
+
usage: "Every interactive element on keyboard focus."
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
var typeStyles = {
|
|
81
|
+
display: { font: "ui", size: 40, lineHeight: 44, weight: 600, sample: "Book the 7:05 to LaGuardia" },
|
|
82
|
+
title: { font: "ui", size: 28, lineHeight: 34, weight: 600, sample: "Choose a fare for your round trip" },
|
|
83
|
+
heading: { font: "ui", size: 20, lineHeight: 28, weight: 600, sample: "Returning flights" },
|
|
84
|
+
body: { font: "ui", size: 15, lineHeight: 22, weight: 400, sample: "Arrival airport and dates come from the event." },
|
|
85
|
+
"body-strong": { font: "ui", size: 15, lineHeight: 22, weight: 600, sample: "7:20 AM \u2013 10:01 AM" },
|
|
86
|
+
label: { font: "ui", size: 13, lineHeight: 18, weight: 500, sample: "Delta \xB7 DL 2122" },
|
|
87
|
+
"label-strong": { font: "ui", size: 13, lineHeight: 18, weight: 600, sample: "Booked" },
|
|
88
|
+
eyebrow: {
|
|
89
|
+
font: "ui",
|
|
90
|
+
size: 13,
|
|
91
|
+
lineHeight: 18,
|
|
92
|
+
weight: 600,
|
|
93
|
+
uppercase: true,
|
|
94
|
+
letterSpacing: "0.08em",
|
|
95
|
+
sample: "Flights \xB7 Shopping list"
|
|
96
|
+
},
|
|
97
|
+
voice: { font: "voice", size: 40, lineHeight: 44, weight: 400, italic: true, sample: "Good evening, Kenneth." },
|
|
98
|
+
"voice-sm": { font: "voice", size: 28, lineHeight: 32, weight: 400, italic: true, sample: "You\u2019re all set, Maya." },
|
|
99
|
+
mono: { font: "code", size: 15, lineHeight: 22, weight: 400, sample: "DL 1482 \xB7 GXK4QP \xB7 $1,440.76" },
|
|
100
|
+
"mono-lg": { font: "code", size: 40, lineHeight: 44, weight: 500, sample: "$495,052.00" }
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// src/lib/cn.ts
|
|
104
|
+
var twMerge = (0, import_tailwind_merge.extendTailwindMerge)({
|
|
105
|
+
extend: {
|
|
106
|
+
theme: {
|
|
107
|
+
spacing: Object.keys(spacing).map((key) => `spacing-${key}`),
|
|
108
|
+
radius: Object.keys(radius).map((key) => `radius-${key}`),
|
|
109
|
+
shadow: Object.keys(elevation).map((key) => `elevation-${key}`)
|
|
110
|
+
},
|
|
111
|
+
classGroups: {
|
|
112
|
+
"type-style": [{ type: Object.keys(typeStyles) }]
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
function cn(...inputs) {
|
|
117
|
+
return twMerge((0, import_clsx.clsx)(inputs));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// src/components/button/button-variants.ts
|
|
121
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
122
|
+
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
123
|
+
[
|
|
124
|
+
"inline-flex shrink-0 items-center justify-center gap-spacing-sm whitespace-nowrap",
|
|
125
|
+
"rounded-radius-full transition-colors",
|
|
126
|
+
"focus-visible:shadow-elevation-focus focus-visible:outline-none",
|
|
127
|
+
"aria-busy:pointer-events-none aria-disabled:pointer-events-none"
|
|
128
|
+
],
|
|
129
|
+
{
|
|
130
|
+
variants: {
|
|
131
|
+
variant: {
|
|
132
|
+
primary: [
|
|
133
|
+
"bg-bg-action text-text-on-action",
|
|
134
|
+
"hover:bg-bg-action-hover active:bg-bg-action-pressed",
|
|
135
|
+
"aria-disabled:bg-bg-sunken aria-disabled:text-text-muted"
|
|
136
|
+
],
|
|
137
|
+
secondary: [
|
|
138
|
+
"border border-border-ink bg-bg-surface text-text-primary",
|
|
139
|
+
"hover:bg-bg-hover active:bg-bg-sunken focus-visible:border-border-focus",
|
|
140
|
+
"aria-disabled:border-border-default aria-disabled:text-text-muted"
|
|
141
|
+
],
|
|
142
|
+
destructive: [
|
|
143
|
+
"border border-status-error-border bg-bg-surface text-status-error-text",
|
|
144
|
+
"hover:bg-status-error-fill active:bg-status-error-fill",
|
|
145
|
+
"aria-disabled:border-border-default aria-disabled:text-text-muted"
|
|
146
|
+
],
|
|
147
|
+
link: [
|
|
148
|
+
"text-text-link",
|
|
149
|
+
"hover:text-text-on-selected active:text-text-on-selected",
|
|
150
|
+
"aria-disabled:text-text-muted"
|
|
151
|
+
]
|
|
152
|
+
},
|
|
153
|
+
size: {
|
|
154
|
+
default: "type-body-strong h-12 px-spacing-xl",
|
|
155
|
+
compact: "type-label-strong h-9 px-spacing-lg"
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
defaultVariants: {
|
|
159
|
+
variant: "primary",
|
|
160
|
+
size: "default"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
// src/components/button/button.tsx
|
|
166
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
167
|
+
var Button = React.forwardRef(
|
|
168
|
+
({ className, variant, size, asChild = false, loading = false, disabled = false, onClick, children, ...props }, ref) => {
|
|
169
|
+
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
170
|
+
const handleClick = (event) => {
|
|
171
|
+
if (loading || disabled) {
|
|
172
|
+
event.preventDefault();
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
onClick?.(event);
|
|
176
|
+
};
|
|
177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
178
|
+
Comp,
|
|
179
|
+
{
|
|
180
|
+
ref,
|
|
181
|
+
...props,
|
|
182
|
+
...asChild ? disabled ? { tabIndex: -1 } : {} : { disabled },
|
|
183
|
+
className: cn(buttonVariants({ variant, size }), className),
|
|
184
|
+
"aria-busy": loading || void 0,
|
|
185
|
+
"aria-disabled": disabled || void 0,
|
|
186
|
+
onClick: handleClick,
|
|
187
|
+
children: [
|
|
188
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
189
|
+
"span",
|
|
190
|
+
{
|
|
191
|
+
"aria-hidden": "true",
|
|
192
|
+
className: "size-4 shrink-0 animate-spin rounded-radius-full border-y-2 border-l-2 border-current"
|
|
193
|
+
}
|
|
194
|
+
) : null,
|
|
195
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_slot.Slottable, { children })
|
|
196
|
+
]
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
);
|
|
201
|
+
Button.displayName = "Button";
|
|
202
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
203
|
+
0 && (module.exports = {
|
|
204
|
+
Button
|
|
205
|
+
});
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
declare const buttonVariants: (props?: ({
|
|
6
|
+
variant?: "link" | "primary" | "secondary" | "destructive" | null | undefined;
|
|
7
|
+
size?: "default" | "compact" | null | undefined;
|
|
8
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
|
+
type ButtonVariantProps = VariantProps<typeof buttonVariants>;
|
|
10
|
+
|
|
11
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, ButtonVariantProps {
|
|
12
|
+
asChild?: boolean;
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
16
|
+
|
|
17
|
+
export { Button, type ButtonProps };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
3
|
+
import { VariantProps } from 'class-variance-authority';
|
|
4
|
+
|
|
5
|
+
declare const buttonVariants: (props?: ({
|
|
6
|
+
variant?: "link" | "primary" | "secondary" | "destructive" | null | undefined;
|
|
7
|
+
size?: "default" | "compact" | null | undefined;
|
|
8
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
|
+
type ButtonVariantProps = VariantProps<typeof buttonVariants>;
|
|
10
|
+
|
|
11
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, ButtonVariantProps {
|
|
12
|
+
asChild?: boolean;
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
16
|
+
|
|
17
|
+
export { Button, type ButtonProps };
|