@spies-ui/react 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +3 -0
- package/.turbo/turbo-build.log +18 -0
- package/CHANGELOG.md +7 -0
- package/dist/index.d.mts +1790 -0
- package/dist/index.d.ts +1790 -0
- package/dist/index.js +777 -0
- package/dist/index.mjs +755 -0
- package/package.json +32 -0
- package/src/components/Avatar/index.tsx +19 -0
- package/src/components/Avatar/styles.ts +31 -0
- package/src/components/Box.tsx +32 -0
- package/src/components/Button.tsx +97 -0
- package/src/components/Checkbox/index.tsx +28 -0
- package/src/components/Checkbox/styles.ts +84 -0
- package/src/components/Dropdown/index.tsx +98 -0
- package/src/components/Dropdown/styles.ts +75 -0
- package/src/components/Heading.tsx +32 -0
- package/src/components/InputBox/index.tsx +24 -0
- package/src/components/InputBox/styles.ts +7 -0
- package/src/components/Text.tsx +45 -0
- package/src/components/TextArea/index.tsx +18 -0
- package/src/components/TextArea/styles.ts +42 -0
- package/src/components/TextInput/index.tsx +22 -0
- package/src/components/TextInput/styles.ts +61 -0
- package/src/index.tsx +9 -0
- package/src/styles/index.ts +36 -0
- package/tsconfig.json +4 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,755 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __objRest = (source, exclude) => {
|
|
25
|
+
var target = {};
|
|
26
|
+
for (var prop in source)
|
|
27
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
if (source != null && __getOwnPropSymbols)
|
|
30
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
+
target[prop] = source[prop];
|
|
33
|
+
}
|
|
34
|
+
return target;
|
|
35
|
+
};
|
|
36
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
37
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
38
|
+
};
|
|
39
|
+
var __copyProps = (to, from, except, desc) => {
|
|
40
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
41
|
+
for (let key of __getOwnPropNames(from))
|
|
42
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
43
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
44
|
+
}
|
|
45
|
+
return to;
|
|
46
|
+
};
|
|
47
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
48
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
49
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
50
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
51
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
52
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
53
|
+
mod
|
|
54
|
+
));
|
|
55
|
+
|
|
56
|
+
// ../tokens/dist/index.js
|
|
57
|
+
var require_dist = __commonJS({
|
|
58
|
+
"../tokens/dist/index.js"(exports, module) {
|
|
59
|
+
"use strict";
|
|
60
|
+
var __defProp2 = Object.defineProperty;
|
|
61
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
62
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
63
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
64
|
+
var __export = (target, all) => {
|
|
65
|
+
for (var name in all)
|
|
66
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
67
|
+
};
|
|
68
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
69
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
70
|
+
for (let key of __getOwnPropNames2(from))
|
|
71
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
72
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
73
|
+
}
|
|
74
|
+
return to;
|
|
75
|
+
};
|
|
76
|
+
var __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
77
|
+
var src_exports = {};
|
|
78
|
+
__export(src_exports, {
|
|
79
|
+
colors: () => colors2,
|
|
80
|
+
fontSizes: () => fontSizes2,
|
|
81
|
+
fontWeights: () => fontWeights2,
|
|
82
|
+
fonts: () => fonts2,
|
|
83
|
+
lineHeights: () => lineHeights2,
|
|
84
|
+
radii: () => radii2,
|
|
85
|
+
space: () => space2
|
|
86
|
+
});
|
|
87
|
+
module.exports = __toCommonJS(src_exports);
|
|
88
|
+
var colors2 = {
|
|
89
|
+
black: "#000000",
|
|
90
|
+
white: "#ffffff",
|
|
91
|
+
smokedWhite: "#f5f5f5",
|
|
92
|
+
richBlack: "#000014",
|
|
93
|
+
gray100: "#e0e0e0",
|
|
94
|
+
gray200: "#a0a6ae",
|
|
95
|
+
gray400: "#7a828e",
|
|
96
|
+
gray500: "#4a5057",
|
|
97
|
+
gray600: "#40454c",
|
|
98
|
+
gray700: "#2f3238",
|
|
99
|
+
gray800: "#1f1f1f",
|
|
100
|
+
gray900: "#141414",
|
|
101
|
+
primary: "#1244ce",
|
|
102
|
+
primaryLight: "#144AE1",
|
|
103
|
+
success: "#86e660",
|
|
104
|
+
warning: "#ffc933",
|
|
105
|
+
danger: "#ef2e3b"
|
|
106
|
+
};
|
|
107
|
+
var space2 = {
|
|
108
|
+
1: "0.25rem",
|
|
109
|
+
2: "0.5rem",
|
|
110
|
+
3: "0.75rem",
|
|
111
|
+
4: "1rem",
|
|
112
|
+
5: "1.25rem",
|
|
113
|
+
6: "1.5rem",
|
|
114
|
+
7: "1.75rem",
|
|
115
|
+
8: "2rem",
|
|
116
|
+
10: "2.5rem",
|
|
117
|
+
12: "3rem",
|
|
118
|
+
16: "4rem",
|
|
119
|
+
20: "5rem",
|
|
120
|
+
40: "10rem",
|
|
121
|
+
64: "16rem",
|
|
122
|
+
80: "20rem"
|
|
123
|
+
};
|
|
124
|
+
var radii2 = {
|
|
125
|
+
px: "1px",
|
|
126
|
+
xs: "4px",
|
|
127
|
+
sm: "6px",
|
|
128
|
+
md: "8px",
|
|
129
|
+
lg: "16px",
|
|
130
|
+
full: "99999px"
|
|
131
|
+
};
|
|
132
|
+
var fonts2 = {
|
|
133
|
+
default: "Roboto, sans-serif",
|
|
134
|
+
heading: "Montserrat, sans-serif",
|
|
135
|
+
code: "monospace"
|
|
136
|
+
};
|
|
137
|
+
var fontSizes2 = {
|
|
138
|
+
xxs: "0.625rem",
|
|
139
|
+
xs: "0.75rem",
|
|
140
|
+
sm: "0.875rem",
|
|
141
|
+
md: "1rem",
|
|
142
|
+
lg: "1.125rem",
|
|
143
|
+
xl: "1.25rem",
|
|
144
|
+
"2xl": "1.5rem",
|
|
145
|
+
"4xl": "2rem",
|
|
146
|
+
"5xl": "2.25rem",
|
|
147
|
+
"6xl": "3rem",
|
|
148
|
+
"7xl": "4rem",
|
|
149
|
+
"8xl": "4.5rem",
|
|
150
|
+
"9xl": "6rem"
|
|
151
|
+
};
|
|
152
|
+
var fontWeights2 = {
|
|
153
|
+
thin: "100",
|
|
154
|
+
extralight: "200",
|
|
155
|
+
light: "300",
|
|
156
|
+
regular: "400",
|
|
157
|
+
medium: "500",
|
|
158
|
+
semibold: "600",
|
|
159
|
+
bold: "700",
|
|
160
|
+
extrabold: "800",
|
|
161
|
+
black: "900"
|
|
162
|
+
};
|
|
163
|
+
var lineHeights2 = {
|
|
164
|
+
shorter: "125%",
|
|
165
|
+
short: "140%",
|
|
166
|
+
base: "160%",
|
|
167
|
+
tall: "180%"
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
// src/styles/index.ts
|
|
173
|
+
var import_tokens = __toESM(require_dist());
|
|
174
|
+
import { createStitches, defaultThemeMap } from "@stitches/react";
|
|
175
|
+
var {
|
|
176
|
+
styled,
|
|
177
|
+
css,
|
|
178
|
+
globalCss,
|
|
179
|
+
keyframes,
|
|
180
|
+
getCssText,
|
|
181
|
+
theme,
|
|
182
|
+
createTheme,
|
|
183
|
+
config
|
|
184
|
+
} = createStitches({
|
|
185
|
+
themeMap: __spreadProps(__spreadValues({}, defaultThemeMap), {
|
|
186
|
+
height: "space",
|
|
187
|
+
width: "space"
|
|
188
|
+
}),
|
|
189
|
+
theme: {
|
|
190
|
+
colors: import_tokens.colors,
|
|
191
|
+
fontSizes: import_tokens.fontSizes,
|
|
192
|
+
fontWeights: import_tokens.fontWeights,
|
|
193
|
+
fonts: import_tokens.fonts,
|
|
194
|
+
lineHeights: import_tokens.lineHeights,
|
|
195
|
+
radii: import_tokens.radii,
|
|
196
|
+
space: import_tokens.space
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
// src/components/Box.tsx
|
|
201
|
+
var Box = styled("div", {
|
|
202
|
+
padding: "$4",
|
|
203
|
+
borderRadius: "$md",
|
|
204
|
+
variants: {
|
|
205
|
+
background: {
|
|
206
|
+
default: {
|
|
207
|
+
backgroundColor: "transparent"
|
|
208
|
+
},
|
|
209
|
+
gray600: {
|
|
210
|
+
backgroundColor: "$gray600"
|
|
211
|
+
},
|
|
212
|
+
gray700: {
|
|
213
|
+
backgroundColor: "$gray700"
|
|
214
|
+
},
|
|
215
|
+
gray800: {
|
|
216
|
+
backgroundColor: "$gray800"
|
|
217
|
+
},
|
|
218
|
+
gray900: {
|
|
219
|
+
backgroundColor: "$gray900"
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
Box.displayName = "Box";
|
|
225
|
+
|
|
226
|
+
// src/components/Text.tsx
|
|
227
|
+
var Text = styled("p", {
|
|
228
|
+
fontFamily: "$default",
|
|
229
|
+
lineHeight: "$base",
|
|
230
|
+
margin: 0,
|
|
231
|
+
color: "$smokedWhite",
|
|
232
|
+
variants: {
|
|
233
|
+
size: {
|
|
234
|
+
xxs: { fontSize: "$xxs" },
|
|
235
|
+
xs: { fontSize: "$xs" },
|
|
236
|
+
sm: { fontSize: "$sm" },
|
|
237
|
+
md: { fontSize: "$md" },
|
|
238
|
+
lg: { fontSize: "$lg" },
|
|
239
|
+
xl: { fontSize: "$xl" },
|
|
240
|
+
"2xl": { fontSize: "$2xl" },
|
|
241
|
+
"4xl": { fontSize: "$4xl" },
|
|
242
|
+
"5xl": { fontSize: "$5xl" },
|
|
243
|
+
"6xl": { fontSize: "$6xl" },
|
|
244
|
+
"7xl": { fontSize: "$7xl" },
|
|
245
|
+
"8xl": { fontSize: "$8xl" },
|
|
246
|
+
"9xl": { fontSize: "$9xl" }
|
|
247
|
+
},
|
|
248
|
+
variant: {
|
|
249
|
+
default: { color: "$smokedWhite" },
|
|
250
|
+
primary: { color: "$primary" },
|
|
251
|
+
danger: { color: "$danger" },
|
|
252
|
+
success: { color: "$success" },
|
|
253
|
+
warning: { color: "$warning" }
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
defaultVariants: {
|
|
257
|
+
size: "md",
|
|
258
|
+
variant: "default"
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
Text.displayName = "Text";
|
|
262
|
+
|
|
263
|
+
// src/components/Heading.tsx
|
|
264
|
+
var Heading = styled("h2", {
|
|
265
|
+
fontFamily: "$heading",
|
|
266
|
+
lineHeight: "$shorter",
|
|
267
|
+
margin: 0,
|
|
268
|
+
color: "$smokedWhite",
|
|
269
|
+
variants: {
|
|
270
|
+
size: {
|
|
271
|
+
sm: { fontSize: "$xl" },
|
|
272
|
+
md: { fontSize: "$2xl" },
|
|
273
|
+
lg: { fontSize: "$4xl" },
|
|
274
|
+
"2xl": { fontSize: "$5xl" },
|
|
275
|
+
"3xl": { fontSize: "$5xl" },
|
|
276
|
+
"4xl": { fontSize: "$6xl" },
|
|
277
|
+
"5xl": { fontSize: "$7xl" },
|
|
278
|
+
"6xl": { fontSize: "$8xl" }
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
defaultVariants: {
|
|
282
|
+
size: "md"
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
Heading.displayName = "Heading";
|
|
286
|
+
|
|
287
|
+
// src/components/Avatar/styles.ts
|
|
288
|
+
import * as Avatar from "@radix-ui/react-avatar";
|
|
289
|
+
var AvatarContainer = styled(Avatar.Root, {
|
|
290
|
+
borderRadius: "$full",
|
|
291
|
+
display: "inline-block",
|
|
292
|
+
width: "$12",
|
|
293
|
+
height: "$12",
|
|
294
|
+
overflow: "hidden"
|
|
295
|
+
});
|
|
296
|
+
var AvatarImage = styled(Avatar.Image, {
|
|
297
|
+
width: "100%",
|
|
298
|
+
height: "100%",
|
|
299
|
+
objectFix: "cover",
|
|
300
|
+
borderRadius: "inherit"
|
|
301
|
+
});
|
|
302
|
+
var AvatarFallback = styled(Avatar.Fallback, {
|
|
303
|
+
width: "100%",
|
|
304
|
+
height: "100%",
|
|
305
|
+
display: "flex",
|
|
306
|
+
alignItems: "center",
|
|
307
|
+
justifyContent: "center",
|
|
308
|
+
backgroundColor: "$gray600",
|
|
309
|
+
color: "$gray800",
|
|
310
|
+
svg: {
|
|
311
|
+
width: "$6",
|
|
312
|
+
height: "$6"
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
// src/components/Avatar/index.tsx
|
|
317
|
+
import { User } from "phosphor-react";
|
|
318
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
319
|
+
function Avatar2(props) {
|
|
320
|
+
return /* @__PURE__ */ jsxs(AvatarContainer, { children: [
|
|
321
|
+
/* @__PURE__ */ jsx(AvatarImage, __spreadValues({}, props)),
|
|
322
|
+
/* @__PURE__ */ jsx(AvatarFallback, { delayMs: 600, children: /* @__PURE__ */ jsx(User, {}) })
|
|
323
|
+
] });
|
|
324
|
+
}
|
|
325
|
+
Avatar2.displayName = "Avatar";
|
|
326
|
+
|
|
327
|
+
// src/components/Button.tsx
|
|
328
|
+
var Button = styled("button", {
|
|
329
|
+
all: "unset",
|
|
330
|
+
fontFamily: "$default",
|
|
331
|
+
fontWeight: "$medium",
|
|
332
|
+
fontSize: "$sm",
|
|
333
|
+
textAlign: "center",
|
|
334
|
+
minWidth: 0,
|
|
335
|
+
boxSizing: "border-box",
|
|
336
|
+
display: "flex",
|
|
337
|
+
alignItems: "center",
|
|
338
|
+
justifyContent: "center",
|
|
339
|
+
gap: "$2",
|
|
340
|
+
cursor: "pointer",
|
|
341
|
+
transition: "0.2s",
|
|
342
|
+
svg: {
|
|
343
|
+
width: "$4",
|
|
344
|
+
height: "$4"
|
|
345
|
+
},
|
|
346
|
+
"&:disabled": {
|
|
347
|
+
cursor: "not-allowed",
|
|
348
|
+
backgroundColor: "$gray200",
|
|
349
|
+
borderColor: "$gray200"
|
|
350
|
+
},
|
|
351
|
+
variants: {
|
|
352
|
+
variant: {
|
|
353
|
+
default: {
|
|
354
|
+
backgroundColor: "transparent",
|
|
355
|
+
border: "2px solid $gray500",
|
|
356
|
+
color: "$smokedWhite",
|
|
357
|
+
"&:not(:disabled):hover": {
|
|
358
|
+
// backgroundColor: '$smokedWhite',
|
|
359
|
+
// borderColor: '$smokedWhite',
|
|
360
|
+
// color: '$gray900',
|
|
361
|
+
borderColor: "$gray600"
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
primary: {
|
|
365
|
+
backgroundColor: "$primary",
|
|
366
|
+
border: "2px solid $primary",
|
|
367
|
+
color: "$smokedWhite",
|
|
368
|
+
"&:not(:disabled):hover": {
|
|
369
|
+
backgroundColor: "$primaryLight",
|
|
370
|
+
borderColor: "$primaryLight"
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
size: {
|
|
375
|
+
default: {
|
|
376
|
+
padding: "$3 $6"
|
|
377
|
+
},
|
|
378
|
+
fit: {
|
|
379
|
+
width: "100%",
|
|
380
|
+
paddingTop: "$3",
|
|
381
|
+
paddingBottom: "$3"
|
|
382
|
+
},
|
|
383
|
+
small: {
|
|
384
|
+
padding: "$3 $4"
|
|
385
|
+
}
|
|
386
|
+
},
|
|
387
|
+
radius: {
|
|
388
|
+
small: {
|
|
389
|
+
borderRadius: "$sm"
|
|
390
|
+
},
|
|
391
|
+
default: {
|
|
392
|
+
borderRadius: "$lg"
|
|
393
|
+
},
|
|
394
|
+
full: {
|
|
395
|
+
borderRadius: "$full"
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
defaultVariants: {
|
|
400
|
+
size: "default",
|
|
401
|
+
radius: "default",
|
|
402
|
+
variant: "default"
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
Button.displayName = "Button";
|
|
406
|
+
|
|
407
|
+
// src/components/TextInput/styles.ts
|
|
408
|
+
var TextInputContainer = styled("div", {
|
|
409
|
+
backgroundColor: "$gray900",
|
|
410
|
+
padding: "$3 $4",
|
|
411
|
+
borderRadius: "$sm",
|
|
412
|
+
boxSizing: "border-box",
|
|
413
|
+
border: "2px solid $gray900",
|
|
414
|
+
display: "flex",
|
|
415
|
+
alignItems: "baseline",
|
|
416
|
+
"&:has(input:focus)": {
|
|
417
|
+
borderColor: "$primary"
|
|
418
|
+
},
|
|
419
|
+
"&:has(input:disabled)": {
|
|
420
|
+
opacity: 0.5,
|
|
421
|
+
cursor: "not-alowed"
|
|
422
|
+
},
|
|
423
|
+
variants: {
|
|
424
|
+
errored: {
|
|
425
|
+
true: {
|
|
426
|
+
borderColor: "$danger"
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
defaultVariants: {
|
|
431
|
+
errored: false
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
var Prefix = styled("span", {
|
|
435
|
+
fontFamily: "$default",
|
|
436
|
+
fontSize: "$sm",
|
|
437
|
+
color: "$gray400",
|
|
438
|
+
fontWeight: "regular"
|
|
439
|
+
});
|
|
440
|
+
var Input = styled("input", {
|
|
441
|
+
fontFamily: "$default",
|
|
442
|
+
fontSize: "$sm",
|
|
443
|
+
color: "$smokedWhite",
|
|
444
|
+
fontWeight: "regular",
|
|
445
|
+
background: "transparent",
|
|
446
|
+
border: 0,
|
|
447
|
+
width: "100%",
|
|
448
|
+
"&:focus": {
|
|
449
|
+
outline: 0
|
|
450
|
+
},
|
|
451
|
+
"&:disabled": {
|
|
452
|
+
cursor: "not-allowed"
|
|
453
|
+
},
|
|
454
|
+
"&:placeholder": {
|
|
455
|
+
color: "$gray400"
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
// src/components/InputBox/styles.ts
|
|
460
|
+
var InputContainer = styled("div", {
|
|
461
|
+
display: "flex",
|
|
462
|
+
flexDirection: "column",
|
|
463
|
+
gap: "$2"
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
// src/components/InputBox/index.tsx
|
|
467
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
468
|
+
function InputBox({ label, error, children }) {
|
|
469
|
+
return /* @__PURE__ */ jsxs2(InputContainer, { children: [
|
|
470
|
+
!!label && /* @__PURE__ */ jsx2(Text, { size: "sm", children: label }),
|
|
471
|
+
children,
|
|
472
|
+
!!error && /* @__PURE__ */ jsx2(Text, { size: "xs", variant: "danger", children: error })
|
|
473
|
+
] });
|
|
474
|
+
}
|
|
475
|
+
InputBox.displayName = "InputBox";
|
|
476
|
+
|
|
477
|
+
// src/components/TextInput/index.tsx
|
|
478
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
479
|
+
function TextInput(_a) {
|
|
480
|
+
var _b = _a, { label, prefix, error } = _b, props = __objRest(_b, ["label", "prefix", "error"]);
|
|
481
|
+
return /* @__PURE__ */ jsx3(InputBox, { label, error, children: /* @__PURE__ */ jsxs3(TextInputContainer, { errored: !!error, children: [
|
|
482
|
+
!!prefix && /* @__PURE__ */ jsx3(Prefix, { children: prefix }),
|
|
483
|
+
/* @__PURE__ */ jsx3(Input, __spreadValues({}, props))
|
|
484
|
+
] }) });
|
|
485
|
+
}
|
|
486
|
+
TextInput.displayName = "TextInput";
|
|
487
|
+
|
|
488
|
+
// src/components/TextArea/styles.ts
|
|
489
|
+
var TextAreaInput = styled("textarea", {
|
|
490
|
+
backgroundColor: "$gray900",
|
|
491
|
+
padding: "$3 $4",
|
|
492
|
+
borderRadius: "$sm",
|
|
493
|
+
boxSizing: "border-box",
|
|
494
|
+
border: "2px solid $gray900",
|
|
495
|
+
fontFamily: "$default",
|
|
496
|
+
fontSize: "$sm",
|
|
497
|
+
color: "$white",
|
|
498
|
+
fontWeight: "$regular",
|
|
499
|
+
resize: "vertical",
|
|
500
|
+
minHeight: 80,
|
|
501
|
+
"&:focus": {
|
|
502
|
+
outline: 0,
|
|
503
|
+
borderColor: "$primary"
|
|
504
|
+
},
|
|
505
|
+
"&:disabled": {
|
|
506
|
+
opacity: 0.5,
|
|
507
|
+
cursor: "not-allowed"
|
|
508
|
+
},
|
|
509
|
+
"&:placeholder": {
|
|
510
|
+
color: "$gray400"
|
|
511
|
+
},
|
|
512
|
+
variants: {
|
|
513
|
+
errored: {
|
|
514
|
+
true: {
|
|
515
|
+
borderColor: "$danger"
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
defaultVariants: {
|
|
520
|
+
errored: false
|
|
521
|
+
}
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
// src/components/TextArea/index.tsx
|
|
525
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
526
|
+
function TextArea(_a) {
|
|
527
|
+
var _b = _a, { label, error } = _b, props = __objRest(_b, ["label", "error"]);
|
|
528
|
+
return /* @__PURE__ */ jsx4(InputBox, { label, error, children: /* @__PURE__ */ jsx4(TextAreaInput, __spreadProps(__spreadValues({}, props), { errored: !!error })) });
|
|
529
|
+
}
|
|
530
|
+
TextArea.displayName = "TextArea";
|
|
531
|
+
|
|
532
|
+
// src/components/Checkbox/index.tsx
|
|
533
|
+
import { Check } from "phosphor-react";
|
|
534
|
+
|
|
535
|
+
// src/components/Checkbox/styles.ts
|
|
536
|
+
import * as Checkbox from "@radix-ui/react-checkbox";
|
|
537
|
+
var CheckboxBox = styled("div", {
|
|
538
|
+
display: "flex",
|
|
539
|
+
gap: "$2",
|
|
540
|
+
"&:has(button:disabled)": {
|
|
541
|
+
opacity: 0.5
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
var CheckboxContainer = styled(Checkbox.Root, {
|
|
545
|
+
all: "unset",
|
|
546
|
+
width: "$6",
|
|
547
|
+
height: "$6",
|
|
548
|
+
backgroundColor: "$gray900",
|
|
549
|
+
borderRadius: "$xs",
|
|
550
|
+
lineHeight: 0,
|
|
551
|
+
cursor: "pointer",
|
|
552
|
+
overflow: "hidden",
|
|
553
|
+
boxSizing: "border-box",
|
|
554
|
+
display: "flex",
|
|
555
|
+
justifyContent: "center",
|
|
556
|
+
alignItems: "center",
|
|
557
|
+
border: "2px solid $gray900",
|
|
558
|
+
'&[data-state="checked"]': {
|
|
559
|
+
backgroundColor: "$primary",
|
|
560
|
+
borderColor: "$primary"
|
|
561
|
+
},
|
|
562
|
+
"&:focus": {
|
|
563
|
+
border: "2px solid $primary"
|
|
564
|
+
},
|
|
565
|
+
"&:disabled": {
|
|
566
|
+
cursor: "not-allowed"
|
|
567
|
+
},
|
|
568
|
+
variants: {
|
|
569
|
+
errored: {
|
|
570
|
+
true: {
|
|
571
|
+
borderColor: "$danger"
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
},
|
|
575
|
+
defaultVariants: {
|
|
576
|
+
errored: false
|
|
577
|
+
}
|
|
578
|
+
});
|
|
579
|
+
var slideIn = keyframes({
|
|
580
|
+
from: {
|
|
581
|
+
transform: "translateX(-100%)"
|
|
582
|
+
},
|
|
583
|
+
to: {
|
|
584
|
+
transform: "translateX(0)"
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
var slideOut = keyframes({
|
|
588
|
+
from: {
|
|
589
|
+
transform: "translateX(0)"
|
|
590
|
+
},
|
|
591
|
+
to: {
|
|
592
|
+
transform: "translateX(100%)"
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
var CheckboxIndicator = styled(Checkbox.Indicator, {
|
|
596
|
+
color: "$smokedWhite",
|
|
597
|
+
width: "$4",
|
|
598
|
+
height: "$4",
|
|
599
|
+
'&[data-state="checked"]': {
|
|
600
|
+
animation: `${slideIn} 100ms ease-out`
|
|
601
|
+
},
|
|
602
|
+
'&[data-state="unchecked"]': {
|
|
603
|
+
animation: `${slideOut} 100ms ease-out`
|
|
604
|
+
}
|
|
605
|
+
});
|
|
606
|
+
|
|
607
|
+
// src/components/Checkbox/index.tsx
|
|
608
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
609
|
+
function Checkbox2(_a) {
|
|
610
|
+
var _b = _a, { label, error } = _b, props = __objRest(_b, ["label", "error"]);
|
|
611
|
+
return /* @__PURE__ */ jsx5(InputBox, { error, children: /* @__PURE__ */ jsxs4(CheckboxBox, { children: [
|
|
612
|
+
/* @__PURE__ */ jsx5(CheckboxContainer, __spreadProps(__spreadValues({}, props), { errored: !!error, children: /* @__PURE__ */ jsx5(CheckboxIndicator, { asChild: true, children: /* @__PURE__ */ jsx5(Check, { weight: "bold" }) }) })),
|
|
613
|
+
!!label && /* @__PURE__ */ jsx5(Text, { size: "sm", children: label })
|
|
614
|
+
] }) });
|
|
615
|
+
}
|
|
616
|
+
Checkbox2.displayName = "Checkbox";
|
|
617
|
+
|
|
618
|
+
// src/components/Dropdown/index.tsx
|
|
619
|
+
import { useRef, useState, useEffect } from "react";
|
|
620
|
+
|
|
621
|
+
// src/components/Dropdown/styles.ts
|
|
622
|
+
var DropdownContainer = styled("div", {
|
|
623
|
+
position: "relative",
|
|
624
|
+
display: "inline-block"
|
|
625
|
+
});
|
|
626
|
+
var DropdownTrigger = styled("span", {});
|
|
627
|
+
var fadeIn = keyframes({
|
|
628
|
+
"0%": { opacity: "0" },
|
|
629
|
+
"100%": { opacity: "1" }
|
|
630
|
+
});
|
|
631
|
+
var DropdownList = styled("ul", {
|
|
632
|
+
position: "absolute",
|
|
633
|
+
// top: '100%',
|
|
634
|
+
// left: 0,
|
|
635
|
+
backgroundColor: "#18181B",
|
|
636
|
+
borderRadius: "$lg",
|
|
637
|
+
padding: 0,
|
|
638
|
+
// margin: '$1 0',
|
|
639
|
+
margin: 0,
|
|
640
|
+
listStyle: "none",
|
|
641
|
+
zIndex: 9999,
|
|
642
|
+
minWidth: "100%",
|
|
643
|
+
// ensures the dropdown list as wide as the container
|
|
644
|
+
left: "50%",
|
|
645
|
+
transform: "translateX(-50%)",
|
|
646
|
+
animation: `${fadeIn} 100ms ease-out`,
|
|
647
|
+
"& li:first-child": {
|
|
648
|
+
marginTop: "$2"
|
|
649
|
+
},
|
|
650
|
+
"& li:last-child": {
|
|
651
|
+
marginBottom: "$2"
|
|
652
|
+
}
|
|
653
|
+
});
|
|
654
|
+
var DropdownItem = styled("li", {
|
|
655
|
+
fontFamily: "$default",
|
|
656
|
+
fontSize: "$sm",
|
|
657
|
+
color: "$smokedWhite",
|
|
658
|
+
padding: "$2 $2",
|
|
659
|
+
marginLeft: "$2",
|
|
660
|
+
marginRight: "$2",
|
|
661
|
+
width: "$40",
|
|
662
|
+
borderRadius: "$md",
|
|
663
|
+
cursor: "pointer",
|
|
664
|
+
variants: {
|
|
665
|
+
variant: {
|
|
666
|
+
default: {
|
|
667
|
+
color: "$smokedWhite",
|
|
668
|
+
"&:hover": {
|
|
669
|
+
backgroundColor: "$gray700"
|
|
670
|
+
}
|
|
671
|
+
},
|
|
672
|
+
danger: {
|
|
673
|
+
color: "$danger",
|
|
674
|
+
"&:hover": {
|
|
675
|
+
backgroundColor: "$danger",
|
|
676
|
+
color: "$smokedWhite"
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
},
|
|
681
|
+
defaultVariants: {
|
|
682
|
+
variant: "default"
|
|
683
|
+
}
|
|
684
|
+
});
|
|
685
|
+
|
|
686
|
+
// src/components/Dropdown/index.tsx
|
|
687
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
688
|
+
function Dropdown({ options, children, name }) {
|
|
689
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
690
|
+
const dropdownRef = useRef(null);
|
|
691
|
+
const buttonRef = useRef(null);
|
|
692
|
+
const toggleDropdown = () => {
|
|
693
|
+
setIsOpen(!isOpen);
|
|
694
|
+
};
|
|
695
|
+
const handleSelectOption = (option) => {
|
|
696
|
+
option.onSelect();
|
|
697
|
+
setIsOpen(false);
|
|
698
|
+
};
|
|
699
|
+
const handleClickOutside = (event) => {
|
|
700
|
+
if (dropdownRef.current && buttonRef.current && !dropdownRef.current.contains(event.target) && !buttonRef.current.contains(event.target)) {
|
|
701
|
+
setIsOpen(false);
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
useEffect(() => {
|
|
705
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
706
|
+
return () => {
|
|
707
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
708
|
+
};
|
|
709
|
+
}, []);
|
|
710
|
+
useEffect(() => {
|
|
711
|
+
const handleReposition = () => {
|
|
712
|
+
if (isOpen && buttonRef.current && dropdownRef.current) {
|
|
713
|
+
const buttonRect = buttonRef.current.getBoundingClientRect();
|
|
714
|
+
const dropdownRect = dropdownRef.current.getBoundingClientRect();
|
|
715
|
+
const buttonTop = buttonRect.top;
|
|
716
|
+
const buttonHeight = buttonRect.height;
|
|
717
|
+
const dropdownHeight = dropdownRect.height;
|
|
718
|
+
const spaceBelow = window.innerHeight - buttonTop - buttonHeight;
|
|
719
|
+
if (spaceBelow < dropdownHeight) {
|
|
720
|
+
dropdownRef.current.style.bottom = `${buttonHeight + 6}px`;
|
|
721
|
+
} else {
|
|
722
|
+
dropdownRef.current.style.top = `${buttonHeight + 6}px`;
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
};
|
|
726
|
+
handleReposition();
|
|
727
|
+
}, [isOpen]);
|
|
728
|
+
return /* @__PURE__ */ jsxs5(DropdownContainer, { children: [
|
|
729
|
+
/* @__PURE__ */ jsxs5(DropdownTrigger, { ref: buttonRef, onClick: toggleDropdown, children: [
|
|
730
|
+
name && children === void 0 && /* @__PURE__ */ jsx6(Button, { children: name }),
|
|
731
|
+
children && name === void 0 && children
|
|
732
|
+
] }),
|
|
733
|
+
isOpen && /* @__PURE__ */ jsx6(DropdownList, { ref: dropdownRef, children: options.map((option, index) => /* @__PURE__ */ jsx6(
|
|
734
|
+
DropdownItem,
|
|
735
|
+
{
|
|
736
|
+
onClick: () => handleSelectOption(option),
|
|
737
|
+
variant: option.variant,
|
|
738
|
+
children: option.text
|
|
739
|
+
},
|
|
740
|
+
index
|
|
741
|
+
)) })
|
|
742
|
+
] });
|
|
743
|
+
}
|
|
744
|
+
Dropdown.displayName = "Dropdown";
|
|
745
|
+
export {
|
|
746
|
+
Avatar2 as Avatar,
|
|
747
|
+
Box,
|
|
748
|
+
Button,
|
|
749
|
+
Checkbox2 as Checkbox,
|
|
750
|
+
Dropdown,
|
|
751
|
+
Heading,
|
|
752
|
+
Text,
|
|
753
|
+
TextArea,
|
|
754
|
+
TextInput
|
|
755
|
+
};
|