@travelallfly/ui 0.0.0-stage → 0.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/LICENSE +21 -0
- package/README.md +163 -2
- package/dist/chunk-C6EI7GYY.js +112 -0
- package/dist/chunk-HX7N52DB.cjs +228 -0
- package/dist/chunk-JH4ANRE2.cjs +112 -0
- package/dist/chunk-NSDKLLVT.js +228 -0
- package/dist/index.cjs +207 -0
- package/dist/index.d.cts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +171 -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 +178 -0
- package/dist/tokens.d.cts +420 -0
- package/dist/tokens.d.ts +420 -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 +116 -4
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
// 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
|
+
raised: "warm/0",
|
|
66
|
+
"image-dim": "#151310@0",
|
|
67
|
+
"art-cream": "#FDEBD5"
|
|
68
|
+
},
|
|
69
|
+
text: {
|
|
70
|
+
primary: "warm/900",
|
|
71
|
+
secondary: "warm/800",
|
|
72
|
+
muted: "warm/600",
|
|
73
|
+
link: "blue/600",
|
|
74
|
+
"on-action": "base/white",
|
|
75
|
+
"on-feature": "base/white",
|
|
76
|
+
"on-feature-muted": "blue/100",
|
|
77
|
+
"on-selected": "blue/700",
|
|
78
|
+
inverse: "warm/0"
|
|
79
|
+
},
|
|
80
|
+
border: {
|
|
81
|
+
default: "warm/200",
|
|
82
|
+
strong: "warm/300",
|
|
83
|
+
control: "warm/400",
|
|
84
|
+
focus: "blue/500",
|
|
85
|
+
selected: "blue/500",
|
|
86
|
+
ink: "warm/900",
|
|
87
|
+
feature: "blue/900"
|
|
88
|
+
},
|
|
89
|
+
status: {
|
|
90
|
+
success: { fill: "palm/50", text: "palm/700", border: "palm/500" },
|
|
91
|
+
info: { fill: "blue/50", text: "blue/700", border: "blue/200" },
|
|
92
|
+
caution: { fill: "marigold/100", text: "marigold/900", icon: "marigold/800", border: "marigold/500" },
|
|
93
|
+
error: { fill: "red/50", text: "red/900", strong: "red/700", border: "red/500" },
|
|
94
|
+
neutral: { fill: "warm/100", text: "warm/800", border: "warm/300" }
|
|
95
|
+
},
|
|
96
|
+
travel: {
|
|
97
|
+
flights: { tint: "blue/50", ink: "blue/700", accent: "blue/500" },
|
|
98
|
+
hotels: { tint: "sunrise/50", ink: "sunrise/700", accent: "sunrise/500" },
|
|
99
|
+
cars: { tint: "marigold/50", ink: "marigold/800", accent: "marigold/500" },
|
|
100
|
+
rail: { tint: "palm/50", ink: "palm/700", accent: "palm/500" }
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
var colorRolesDark = {
|
|
104
|
+
bg: {
|
|
105
|
+
page: "#151310",
|
|
106
|
+
surface: "warm/900",
|
|
107
|
+
sunken: "#2A2723",
|
|
108
|
+
hover: "#26231F",
|
|
109
|
+
selected: "#172A45",
|
|
110
|
+
feature: "blue/900",
|
|
111
|
+
action: "blue/500",
|
|
112
|
+
"action-hover": "blue/600",
|
|
113
|
+
"action-pressed": "blue/700",
|
|
114
|
+
inverse: "warm/100",
|
|
115
|
+
scrim: "#0A0908@72",
|
|
116
|
+
raised: "#2E2A26",
|
|
117
|
+
"image-dim": "#151310@10",
|
|
118
|
+
"art-cream": "#FDEBD5"
|
|
119
|
+
},
|
|
120
|
+
text: {
|
|
121
|
+
primary: "warm/100",
|
|
122
|
+
secondary: "#D4CBBE",
|
|
123
|
+
muted: "#ABA294",
|
|
124
|
+
link: "blue/300",
|
|
125
|
+
"on-action": "base/white",
|
|
126
|
+
"on-feature": "base/white",
|
|
127
|
+
"on-feature-muted": "blue/100",
|
|
128
|
+
"on-selected": "blue/200",
|
|
129
|
+
inverse: "warm/900"
|
|
130
|
+
},
|
|
131
|
+
border: {
|
|
132
|
+
default: "#38342E",
|
|
133
|
+
strong: "#4F4941",
|
|
134
|
+
control: "#857C70",
|
|
135
|
+
focus: "blue/300",
|
|
136
|
+
selected: "blue/300",
|
|
137
|
+
ink: "warm/100",
|
|
138
|
+
feature: "#1E3A70"
|
|
139
|
+
},
|
|
140
|
+
status: {
|
|
141
|
+
success: { fill: "#13291F", text: "#86D3B2", border: "#3DB489" },
|
|
142
|
+
info: { fill: "#15243A", text: "#A9CBF7", border: "#2E4F7C" },
|
|
143
|
+
caution: { fill: "#2D2412", text: "#F5CB78", icon: "marigold/500", border: "#7A5A17" },
|
|
144
|
+
error: { fill: "#341A18", text: "#F6A8A0", strong: "#EE7A70", border: "#8A3530" },
|
|
145
|
+
neutral: { fill: "#2A2723", text: "#D4CBBE", border: "#4F4941" }
|
|
146
|
+
},
|
|
147
|
+
travel: {
|
|
148
|
+
flights: { tint: "#172A45", ink: "blue/200", accent: "blue/500" },
|
|
149
|
+
hotels: { tint: "#33201A", ink: "#F59A7C", accent: "sunrise/500" },
|
|
150
|
+
cars: { tint: "#2D2412", ink: "#F5C46A", accent: "marigold/500" },
|
|
151
|
+
rail: { tint: "#13291F", ink: "#7CCCAD", accent: "palm/500" }
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
var darkRolesUnverified = ["border/selected"];
|
|
155
|
+
var spacing = {
|
|
156
|
+
xs: 4,
|
|
157
|
+
sm: 8,
|
|
158
|
+
md: 12,
|
|
159
|
+
lg: 16,
|
|
160
|
+
xl: 24,
|
|
161
|
+
"2xl": 32,
|
|
162
|
+
"3xl": 48,
|
|
163
|
+
"4xl": 64
|
|
164
|
+
};
|
|
165
|
+
var radius = {
|
|
166
|
+
xs: { value: 4, usage: "Checkboxes" },
|
|
167
|
+
sm: { value: 8, usage: "Tooltips, seats" },
|
|
168
|
+
md: { value: 12, usage: "Inputs, nav items" },
|
|
169
|
+
lg: { value: 16, usage: "Banners, toasts" },
|
|
170
|
+
xl: { value: 24, usage: "Cards" },
|
|
171
|
+
"2xl": { value: 32, usage: "Modals" },
|
|
172
|
+
full: { value: 9999, usage: "Buttons, chips" }
|
|
173
|
+
};
|
|
174
|
+
var elevation = {
|
|
175
|
+
raised: {
|
|
176
|
+
value: "0 6px 16px rgba(31, 29, 26, 0.06)",
|
|
177
|
+
dark: "none",
|
|
178
|
+
usage: "The booking card, popovers, the selected fare. No shadow in dark: the lighter surface does the lifting."
|
|
179
|
+
},
|
|
180
|
+
floating: {
|
|
181
|
+
value: "0 12px 32px rgba(31, 29, 26, 0.12)",
|
|
182
|
+
dark: "0 12px 32px rgba(10, 9, 8, 0.5)",
|
|
183
|
+
usage: "Modals, menus and toasts, over the scrim."
|
|
184
|
+
},
|
|
185
|
+
focus: {
|
|
186
|
+
value: "0 0 0 4px color-mix(in srgb, var(--af-bg-action) 30%, transparent)",
|
|
187
|
+
usage: "Every interactive element on keyboard focus."
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
var fonts = {
|
|
191
|
+
ui: ['"Figtree Variable"', "Figtree", "ui-sans-serif", "system-ui", "sans-serif"],
|
|
192
|
+
voice: ['"Instrument Serif"', "ui-serif", "Georgia", "serif"],
|
|
193
|
+
code: ['"Geist Mono Variable"', '"Geist Mono"', "ui-monospace", "SFMono-Regular", "monospace"]
|
|
194
|
+
};
|
|
195
|
+
var typeStyles = {
|
|
196
|
+
display: { font: "ui", size: 40, lineHeight: 44, weight: 600, sample: "Book the 7:05 to LaGuardia" },
|
|
197
|
+
title: { font: "ui", size: 28, lineHeight: 34, weight: 600, sample: "Choose a fare for your round trip" },
|
|
198
|
+
heading: { font: "ui", size: 20, lineHeight: 28, weight: 600, sample: "Returning flights" },
|
|
199
|
+
body: { font: "ui", size: 15, lineHeight: 22, weight: 400, sample: "Arrival airport and dates come from the event." },
|
|
200
|
+
"body-strong": { font: "ui", size: 15, lineHeight: 22, weight: 600, sample: "7:20 AM \u2013 10:01 AM" },
|
|
201
|
+
label: { font: "ui", size: 13, lineHeight: 18, weight: 500, sample: "Delta \xB7 DL 2122" },
|
|
202
|
+
"label-strong": { font: "ui", size: 13, lineHeight: 18, weight: 600, sample: "Booked" },
|
|
203
|
+
eyebrow: {
|
|
204
|
+
font: "ui",
|
|
205
|
+
size: 13,
|
|
206
|
+
lineHeight: 18,
|
|
207
|
+
weight: 600,
|
|
208
|
+
uppercase: true,
|
|
209
|
+
letterSpacing: "0.08em",
|
|
210
|
+
sample: "Flights \xB7 Shopping list"
|
|
211
|
+
},
|
|
212
|
+
voice: { font: "voice", size: 40, lineHeight: 44, weight: 400, italic: true, sample: "Good evening, Kenneth." },
|
|
213
|
+
"voice-sm": { font: "voice", size: 28, lineHeight: 32, weight: 400, italic: true, sample: "You\u2019re all set, Maya." },
|
|
214
|
+
mono: { font: "code", size: 15, lineHeight: 22, weight: 400, sample: "DL 1482 \xB7 GXK4QP \xB7 $1,440.76" },
|
|
215
|
+
"mono-lg": { font: "code", size: 40, lineHeight: 44, weight: 500, sample: "$495,052.00" }
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
export {
|
|
219
|
+
primitives,
|
|
220
|
+
colorRoles,
|
|
221
|
+
colorRolesDark,
|
|
222
|
+
darkRolesUnverified,
|
|
223
|
+
spacing,
|
|
224
|
+
radius,
|
|
225
|
+
elevation,
|
|
226
|
+
fonts,
|
|
227
|
+
typeStyles
|
|
228
|
+
};
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
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 6px 16px rgba(31, 29, 26, 0.06)",
|
|
69
|
+
dark: "none",
|
|
70
|
+
usage: "The booking card, popovers, the selected fare. No shadow in dark: the lighter surface does the lifting."
|
|
71
|
+
},
|
|
72
|
+
floating: {
|
|
73
|
+
value: "0 12px 32px rgba(31, 29, 26, 0.12)",
|
|
74
|
+
dark: "0 12px 32px rgba(10, 9, 8, 0.5)",
|
|
75
|
+
usage: "Modals, menus and toasts, over the scrim."
|
|
76
|
+
},
|
|
77
|
+
focus: {
|
|
78
|
+
value: "0 0 0 4px color-mix(in srgb, var(--af-bg-action) 30%, transparent)",
|
|
79
|
+
usage: "Every interactive element on keyboard focus."
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
var typeStyles = {
|
|
83
|
+
display: { font: "ui", size: 40, lineHeight: 44, weight: 600, sample: "Book the 7:05 to LaGuardia" },
|
|
84
|
+
title: { font: "ui", size: 28, lineHeight: 34, weight: 600, sample: "Choose a fare for your round trip" },
|
|
85
|
+
heading: { font: "ui", size: 20, lineHeight: 28, weight: 600, sample: "Returning flights" },
|
|
86
|
+
body: { font: "ui", size: 15, lineHeight: 22, weight: 400, sample: "Arrival airport and dates come from the event." },
|
|
87
|
+
"body-strong": { font: "ui", size: 15, lineHeight: 22, weight: 600, sample: "7:20 AM \u2013 10:01 AM" },
|
|
88
|
+
label: { font: "ui", size: 13, lineHeight: 18, weight: 500, sample: "Delta \xB7 DL 2122" },
|
|
89
|
+
"label-strong": { font: "ui", size: 13, lineHeight: 18, weight: 600, sample: "Booked" },
|
|
90
|
+
eyebrow: {
|
|
91
|
+
font: "ui",
|
|
92
|
+
size: 13,
|
|
93
|
+
lineHeight: 18,
|
|
94
|
+
weight: 600,
|
|
95
|
+
uppercase: true,
|
|
96
|
+
letterSpacing: "0.08em",
|
|
97
|
+
sample: "Flights \xB7 Shopping list"
|
|
98
|
+
},
|
|
99
|
+
voice: { font: "voice", size: 40, lineHeight: 44, weight: 400, italic: true, sample: "Good evening, Kenneth." },
|
|
100
|
+
"voice-sm": { font: "voice", size: 28, lineHeight: 32, weight: 400, italic: true, sample: "You\u2019re all set, Maya." },
|
|
101
|
+
mono: { font: "code", size: 15, lineHeight: 22, weight: 400, sample: "DL 1482 \xB7 GXK4QP \xB7 $1,440.76" },
|
|
102
|
+
"mono-lg": { font: "code", size: 40, lineHeight: 44, weight: 500, sample: "$495,052.00" }
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// src/lib/cn.ts
|
|
106
|
+
var twMerge = (0, import_tailwind_merge.extendTailwindMerge)({
|
|
107
|
+
extend: {
|
|
108
|
+
theme: {
|
|
109
|
+
spacing: Object.keys(spacing).map((key) => `spacing-${key}`),
|
|
110
|
+
radius: Object.keys(radius).map((key) => `radius-${key}`),
|
|
111
|
+
shadow: Object.keys(elevation).map((key) => `elevation-${key}`)
|
|
112
|
+
},
|
|
113
|
+
classGroups: {
|
|
114
|
+
"type-style": [{ type: Object.keys(typeStyles) }]
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
function cn(...inputs) {
|
|
119
|
+
return twMerge((0, import_clsx.clsx)(inputs));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// src/components/button/button-variants.ts
|
|
123
|
+
var import_class_variance_authority = require("class-variance-authority");
|
|
124
|
+
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
125
|
+
[
|
|
126
|
+
"inline-flex shrink-0 items-center justify-center gap-spacing-sm whitespace-nowrap",
|
|
127
|
+
"rounded-radius-full transition-colors",
|
|
128
|
+
"focus-visible:shadow-elevation-focus focus-visible:outline-none",
|
|
129
|
+
"aria-busy:pointer-events-none aria-disabled:pointer-events-none"
|
|
130
|
+
],
|
|
131
|
+
{
|
|
132
|
+
variants: {
|
|
133
|
+
variant: {
|
|
134
|
+
primary: [
|
|
135
|
+
"bg-bg-action text-text-on-action",
|
|
136
|
+
"hover:bg-bg-action-hover active:bg-bg-action-pressed",
|
|
137
|
+
"aria-disabled:bg-bg-sunken aria-disabled:text-text-muted"
|
|
138
|
+
],
|
|
139
|
+
secondary: [
|
|
140
|
+
"border border-border-ink bg-bg-surface text-text-primary",
|
|
141
|
+
"hover:bg-bg-hover active:bg-bg-sunken focus-visible:border-border-focus",
|
|
142
|
+
"aria-disabled:border-border-default aria-disabled:text-text-muted"
|
|
143
|
+
],
|
|
144
|
+
destructive: [
|
|
145
|
+
"border border-status-error-border bg-bg-surface text-status-error-text",
|
|
146
|
+
"hover:bg-status-error-fill active:bg-status-error-fill",
|
|
147
|
+
"aria-disabled:border-border-default aria-disabled:text-text-muted"
|
|
148
|
+
],
|
|
149
|
+
link: [
|
|
150
|
+
"text-text-link",
|
|
151
|
+
"hover:text-text-on-selected active:text-text-on-selected",
|
|
152
|
+
"aria-disabled:text-text-muted"
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
size: {
|
|
156
|
+
default: "type-body-strong h-12 px-spacing-xl",
|
|
157
|
+
compact: "type-label-strong h-9 px-spacing-lg"
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
defaultVariants: {
|
|
161
|
+
variant: "primary",
|
|
162
|
+
size: "default"
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
// src/components/button/button.tsx
|
|
168
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
169
|
+
var Button = React.forwardRef(
|
|
170
|
+
({ className, variant, size, asChild = false, loading = false, disabled = false, onClick, children, ...props }, ref) => {
|
|
171
|
+
const Comp = asChild ? import_react_slot.Slot : "button";
|
|
172
|
+
const handleClick = (event) => {
|
|
173
|
+
if (loading || disabled) {
|
|
174
|
+
event.preventDefault();
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
onClick?.(event);
|
|
178
|
+
};
|
|
179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
180
|
+
Comp,
|
|
181
|
+
{
|
|
182
|
+
ref,
|
|
183
|
+
...props,
|
|
184
|
+
...asChild ? disabled ? { tabIndex: -1 } : {} : { disabled },
|
|
185
|
+
className: cn(buttonVariants({ variant, size }), className),
|
|
186
|
+
"aria-busy": loading || void 0,
|
|
187
|
+
"aria-disabled": disabled || void 0,
|
|
188
|
+
onClick: handleClick,
|
|
189
|
+
children: [
|
|
190
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
191
|
+
"span",
|
|
192
|
+
{
|
|
193
|
+
"aria-hidden": "true",
|
|
194
|
+
className: "size-4 shrink-0 animate-spin rounded-radius-full border-y-2 border-l-2 border-current"
|
|
195
|
+
}
|
|
196
|
+
) : null,
|
|
197
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_slot.Slottable, { children })
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
);
|
|
203
|
+
Button.displayName = "Button";
|
|
204
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
205
|
+
0 && (module.exports = {
|
|
206
|
+
Button
|
|
207
|
+
});
|
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 };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/components/button/button.tsx
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { Slot, Slottable } from "@radix-ui/react-slot";
|
|
6
|
+
|
|
7
|
+
// src/lib/cn.ts
|
|
8
|
+
import { clsx } from "clsx";
|
|
9
|
+
import { extendTailwindMerge } from "tailwind-merge";
|
|
10
|
+
|
|
11
|
+
// src/tokens/tokens.ts
|
|
12
|
+
var spacing = {
|
|
13
|
+
xs: 4,
|
|
14
|
+
sm: 8,
|
|
15
|
+
md: 12,
|
|
16
|
+
lg: 16,
|
|
17
|
+
xl: 24,
|
|
18
|
+
"2xl": 32,
|
|
19
|
+
"3xl": 48,
|
|
20
|
+
"4xl": 64
|
|
21
|
+
};
|
|
22
|
+
var radius = {
|
|
23
|
+
xs: { value: 4, usage: "Checkboxes" },
|
|
24
|
+
sm: { value: 8, usage: "Tooltips, seats" },
|
|
25
|
+
md: { value: 12, usage: "Inputs, nav items" },
|
|
26
|
+
lg: { value: 16, usage: "Banners, toasts" },
|
|
27
|
+
xl: { value: 24, usage: "Cards" },
|
|
28
|
+
"2xl": { value: 32, usage: "Modals" },
|
|
29
|
+
full: { value: 9999, usage: "Buttons, chips" }
|
|
30
|
+
};
|
|
31
|
+
var elevation = {
|
|
32
|
+
raised: {
|
|
33
|
+
value: "0 6px 16px rgba(31, 29, 26, 0.06)",
|
|
34
|
+
dark: "none",
|
|
35
|
+
usage: "The booking card, popovers, the selected fare. No shadow in dark: the lighter surface does the lifting."
|
|
36
|
+
},
|
|
37
|
+
floating: {
|
|
38
|
+
value: "0 12px 32px rgba(31, 29, 26, 0.12)",
|
|
39
|
+
dark: "0 12px 32px rgba(10, 9, 8, 0.5)",
|
|
40
|
+
usage: "Modals, menus and toasts, over the scrim."
|
|
41
|
+
},
|
|
42
|
+
focus: {
|
|
43
|
+
value: "0 0 0 4px color-mix(in srgb, var(--af-bg-action) 30%, transparent)",
|
|
44
|
+
usage: "Every interactive element on keyboard focus."
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var typeStyles = {
|
|
48
|
+
display: { font: "ui", size: 40, lineHeight: 44, weight: 600, sample: "Book the 7:05 to LaGuardia" },
|
|
49
|
+
title: { font: "ui", size: 28, lineHeight: 34, weight: 600, sample: "Choose a fare for your round trip" },
|
|
50
|
+
heading: { font: "ui", size: 20, lineHeight: 28, weight: 600, sample: "Returning flights" },
|
|
51
|
+
body: { font: "ui", size: 15, lineHeight: 22, weight: 400, sample: "Arrival airport and dates come from the event." },
|
|
52
|
+
"body-strong": { font: "ui", size: 15, lineHeight: 22, weight: 600, sample: "7:20 AM \u2013 10:01 AM" },
|
|
53
|
+
label: { font: "ui", size: 13, lineHeight: 18, weight: 500, sample: "Delta \xB7 DL 2122" },
|
|
54
|
+
"label-strong": { font: "ui", size: 13, lineHeight: 18, weight: 600, sample: "Booked" },
|
|
55
|
+
eyebrow: {
|
|
56
|
+
font: "ui",
|
|
57
|
+
size: 13,
|
|
58
|
+
lineHeight: 18,
|
|
59
|
+
weight: 600,
|
|
60
|
+
uppercase: true,
|
|
61
|
+
letterSpacing: "0.08em",
|
|
62
|
+
sample: "Flights \xB7 Shopping list"
|
|
63
|
+
},
|
|
64
|
+
voice: { font: "voice", size: 40, lineHeight: 44, weight: 400, italic: true, sample: "Good evening, Kenneth." },
|
|
65
|
+
"voice-sm": { font: "voice", size: 28, lineHeight: 32, weight: 400, italic: true, sample: "You\u2019re all set, Maya." },
|
|
66
|
+
mono: { font: "code", size: 15, lineHeight: 22, weight: 400, sample: "DL 1482 \xB7 GXK4QP \xB7 $1,440.76" },
|
|
67
|
+
"mono-lg": { font: "code", size: 40, lineHeight: 44, weight: 500, sample: "$495,052.00" }
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// src/lib/cn.ts
|
|
71
|
+
var twMerge = extendTailwindMerge({
|
|
72
|
+
extend: {
|
|
73
|
+
theme: {
|
|
74
|
+
spacing: Object.keys(spacing).map((key) => `spacing-${key}`),
|
|
75
|
+
radius: Object.keys(radius).map((key) => `radius-${key}`),
|
|
76
|
+
shadow: Object.keys(elevation).map((key) => `elevation-${key}`)
|
|
77
|
+
},
|
|
78
|
+
classGroups: {
|
|
79
|
+
"type-style": [{ type: Object.keys(typeStyles) }]
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
function cn(...inputs) {
|
|
84
|
+
return twMerge(clsx(inputs));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// src/components/button/button-variants.ts
|
|
88
|
+
import { cva } from "class-variance-authority";
|
|
89
|
+
var buttonVariants = cva(
|
|
90
|
+
[
|
|
91
|
+
"inline-flex shrink-0 items-center justify-center gap-spacing-sm whitespace-nowrap",
|
|
92
|
+
"rounded-radius-full transition-colors",
|
|
93
|
+
"focus-visible:shadow-elevation-focus focus-visible:outline-none",
|
|
94
|
+
"aria-busy:pointer-events-none aria-disabled:pointer-events-none"
|
|
95
|
+
],
|
|
96
|
+
{
|
|
97
|
+
variants: {
|
|
98
|
+
variant: {
|
|
99
|
+
primary: [
|
|
100
|
+
"bg-bg-action text-text-on-action",
|
|
101
|
+
"hover:bg-bg-action-hover active:bg-bg-action-pressed",
|
|
102
|
+
"aria-disabled:bg-bg-sunken aria-disabled:text-text-muted"
|
|
103
|
+
],
|
|
104
|
+
secondary: [
|
|
105
|
+
"border border-border-ink bg-bg-surface text-text-primary",
|
|
106
|
+
"hover:bg-bg-hover active:bg-bg-sunken focus-visible:border-border-focus",
|
|
107
|
+
"aria-disabled:border-border-default aria-disabled:text-text-muted"
|
|
108
|
+
],
|
|
109
|
+
destructive: [
|
|
110
|
+
"border border-status-error-border bg-bg-surface text-status-error-text",
|
|
111
|
+
"hover:bg-status-error-fill active:bg-status-error-fill",
|
|
112
|
+
"aria-disabled:border-border-default aria-disabled:text-text-muted"
|
|
113
|
+
],
|
|
114
|
+
link: [
|
|
115
|
+
"text-text-link",
|
|
116
|
+
"hover:text-text-on-selected active:text-text-on-selected",
|
|
117
|
+
"aria-disabled:text-text-muted"
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
size: {
|
|
121
|
+
default: "type-body-strong h-12 px-spacing-xl",
|
|
122
|
+
compact: "type-label-strong h-9 px-spacing-lg"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
defaultVariants: {
|
|
126
|
+
variant: "primary",
|
|
127
|
+
size: "default"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
// src/components/button/button.tsx
|
|
133
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
134
|
+
var Button = React.forwardRef(
|
|
135
|
+
({ className, variant, size, asChild = false, loading = false, disabled = false, onClick, children, ...props }, ref) => {
|
|
136
|
+
const Comp = asChild ? Slot : "button";
|
|
137
|
+
const handleClick = (event) => {
|
|
138
|
+
if (loading || disabled) {
|
|
139
|
+
event.preventDefault();
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
onClick?.(event);
|
|
143
|
+
};
|
|
144
|
+
return /* @__PURE__ */ jsxs(
|
|
145
|
+
Comp,
|
|
146
|
+
{
|
|
147
|
+
ref,
|
|
148
|
+
...props,
|
|
149
|
+
...asChild ? disabled ? { tabIndex: -1 } : {} : { disabled },
|
|
150
|
+
className: cn(buttonVariants({ variant, size }), className),
|
|
151
|
+
"aria-busy": loading || void 0,
|
|
152
|
+
"aria-disabled": disabled || void 0,
|
|
153
|
+
onClick: handleClick,
|
|
154
|
+
children: [
|
|
155
|
+
loading ? /* @__PURE__ */ jsx(
|
|
156
|
+
"span",
|
|
157
|
+
{
|
|
158
|
+
"aria-hidden": "true",
|
|
159
|
+
className: "size-4 shrink-0 animate-spin rounded-radius-full border-y-2 border-l-2 border-current"
|
|
160
|
+
}
|
|
161
|
+
) : null,
|
|
162
|
+
/* @__PURE__ */ jsx(Slottable, { children })
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
Button.displayName = "Button";
|
|
169
|
+
export {
|
|
170
|
+
Button
|
|
171
|
+
};
|