@giv-igniteui/react 2.0.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/dist/index.mjs ADDED
@@ -0,0 +1,504 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __objRest = (source, exclude) => {
21
+ var target = {};
22
+ for (var prop in source)
23
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
+ target[prop] = source[prop];
25
+ if (source != null && __getOwnPropSymbols)
26
+ for (var prop of __getOwnPropSymbols(source)) {
27
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
+ target[prop] = source[prop];
29
+ }
30
+ return target;
31
+ };
32
+
33
+ // ../tokens/dist/index.mjs
34
+ var colors = {
35
+ white: "#FFF",
36
+ black: "#000",
37
+ gray100: "#E1E1E6",
38
+ gray200: "#A9A9B2",
39
+ gray400: "#7C7C8A",
40
+ gray500: "#505059",
41
+ gray600: "#323238",
42
+ gray700: "#29292E",
43
+ gray800: "#202024",
44
+ gray900: "#121214",
45
+ ignite300: "#00B37E",
46
+ ignite500: "#00875F",
47
+ ignite700: "#015F43",
48
+ ignite900: "#00291D"
49
+ };
50
+ var space = {
51
+ 1: "0.25rem",
52
+ 2: "0.5rem",
53
+ 3: "0.75rem",
54
+ 4: "1rem",
55
+ 5: "1.25rem",
56
+ 6: "1.5rem",
57
+ 7: "1.75rem",
58
+ 8: "2rem",
59
+ 10: "2.5rem",
60
+ 12: "3rem",
61
+ 16: "4rem",
62
+ 20: "5rem",
63
+ 40: "10rem",
64
+ 64: "16rem",
65
+ 80: "20rem"
66
+ };
67
+ var radii = {
68
+ px: "1px",
69
+ xs: "4px",
70
+ sm: "6px",
71
+ md: "8px",
72
+ lg: "16px",
73
+ full: "99999px"
74
+ };
75
+ var fonts = {
76
+ default: "Roboto, sans-serif",
77
+ code: "monospace"
78
+ };
79
+ var fontSizes = {
80
+ xxs: "0.625rem",
81
+ xs: "0.75rem",
82
+ sm: "0.875rem",
83
+ md: "1rem",
84
+ lg: "1.125rem",
85
+ xl: "1.25rem",
86
+ "2xl": "1.5rem",
87
+ "4xl": "2rem",
88
+ "5xl": "2.25rem",
89
+ "6xl": "3rem",
90
+ "7xl": "4rem",
91
+ "8xl": "4.5rem",
92
+ "9xl": "6rem"
93
+ };
94
+ var fontWeights = {
95
+ regular: "400",
96
+ medium: "500",
97
+ bold: "700"
98
+ };
99
+ var lineHeights = {
100
+ shorter: "125%",
101
+ short: "140%",
102
+ base: "160%",
103
+ tall: "180%"
104
+ };
105
+
106
+ // src/styles/index.ts
107
+ import { createStitches, defaultThemeMap } from "@stitches/react";
108
+ var {
109
+ styled,
110
+ css,
111
+ globalCss,
112
+ keyframes,
113
+ getCssText,
114
+ theme,
115
+ createTheme,
116
+ config
117
+ } = createStitches({
118
+ themeMap: __spreadProps(__spreadValues({}, defaultThemeMap), {
119
+ height: "space",
120
+ width: "space"
121
+ }),
122
+ theme: {
123
+ colors,
124
+ fontSizes,
125
+ fontWeights,
126
+ fonts,
127
+ lineHeights,
128
+ radii,
129
+ // borderRadius
130
+ space
131
+ }
132
+ });
133
+
134
+ // src/components/Box.tsx
135
+ var Box = styled("div", {
136
+ padding: "$4",
137
+ borderRadius: "$md",
138
+ backgroundColor: "$gray800",
139
+ border: "1px solid $gray600"
140
+ });
141
+ Box.displayName = "Box";
142
+
143
+ // src/components/Text.tsx
144
+ var Text = styled("p", {
145
+ fontFamily: "$default",
146
+ lineHeight: "$base",
147
+ margin: 0,
148
+ color: "$gray100",
149
+ variants: {
150
+ size: {
151
+ xxs: { fontSize: "$xxs" },
152
+ xs: { fontSize: "$xs" },
153
+ sm: { fontSize: "$sm" },
154
+ md: { fontSize: "$md" },
155
+ lg: { fontSize: "$lg" },
156
+ xl: { fontSize: "$xl" },
157
+ "2xl": { fontSize: "$2xl" },
158
+ "4xl": { fontSize: "$4xl" },
159
+ "5xl": { fontSize: "$5xl" },
160
+ "6xl": { fontSize: "$6xl" },
161
+ "7xl": { fontSize: "$7xl" },
162
+ "8xl": { fontSize: "$8xl" },
163
+ "9xl": { fontSize: "$9xl" }
164
+ }
165
+ },
166
+ defaultVariants: {
167
+ size: "md"
168
+ }
169
+ });
170
+ Text.displayName = "Text";
171
+
172
+ // src/components/Heading.tsx
173
+ var Heading = styled("h2", {
174
+ fontFamily: "$default",
175
+ lineHeight: "$shorter",
176
+ margin: 0,
177
+ color: "$gray100",
178
+ variants: {
179
+ size: {
180
+ sm: { fontSize: "$xl" },
181
+ md: { fontSize: "$2xl" },
182
+ lg: { fontSize: "$4xl" },
183
+ "2xl": { fontSize: "$5xl" },
184
+ "3xl": { fontSize: "$6xl" },
185
+ "4xl": { fontSize: "$7xl" },
186
+ "5xl": { fontSize: "$8xl" },
187
+ "6xl": { fontSize: "$9xl" }
188
+ }
189
+ },
190
+ defaultVariants: {
191
+ size: "md"
192
+ }
193
+ });
194
+ Heading.displayName = "Heading";
195
+
196
+ // src/components/Avatar/styles.ts
197
+ import * as Avatar from "@radix-ui/react-avatar";
198
+ var AvatarContainer = styled(Avatar.Root, {
199
+ borderRadius: "$full",
200
+ display: "inline-block",
201
+ width: "$12",
202
+ height: "$12",
203
+ overflow: "hidden"
204
+ });
205
+ var AvatarImage = styled(Avatar.Image, {
206
+ width: "100%",
207
+ height: "100%",
208
+ objectFit: "cover",
209
+ borderRadius: "$full"
210
+ });
211
+ var AvatarFallback = styled(Avatar.Fallback, {
212
+ width: "100%",
213
+ height: "100%",
214
+ display: "flex",
215
+ alignItems: "center",
216
+ justifyContent: "center",
217
+ backgroundColor: "$gray600",
218
+ color: "$gray800",
219
+ svg: {
220
+ width: "$6",
221
+ height: "$6"
222
+ }
223
+ });
224
+
225
+ // src/components/Avatar/index.tsx
226
+ import { User } from "phosphor-react";
227
+ import { jsx, jsxs } from "react/jsx-runtime";
228
+ function Avatar2(props) {
229
+ return /* @__PURE__ */ jsxs(AvatarContainer, { children: [
230
+ /* @__PURE__ */ jsx(AvatarImage, __spreadValues({}, props)),
231
+ /* @__PURE__ */ jsx(AvatarFallback, { delayMs: 600, children: /* @__PURE__ */ jsx(User, {}) })
232
+ ] });
233
+ }
234
+ Avatar2.displayName = "Avatar";
235
+
236
+ // src/components/Button.tsx
237
+ var Button = styled("button", {
238
+ all: "unset",
239
+ borderRadius: "$sm",
240
+ fontSize: "$sm",
241
+ fontWeight: "$medium",
242
+ fontFamily: "$default",
243
+ textAlign: "center",
244
+ minWidth: 120,
245
+ boxSizing: "border-box",
246
+ display: "flex",
247
+ alignItems: "center",
248
+ justifyContent: "center",
249
+ gap: "$2",
250
+ cursor: "pointer",
251
+ padding: "0 $4",
252
+ svg: {
253
+ width: "$4",
254
+ height: "$4"
255
+ },
256
+ "&:disabled": {
257
+ cursor: "not-allowed"
258
+ },
259
+ variants: {
260
+ variant: {
261
+ primary: {
262
+ color: "$white",
263
+ background: "$ignite500",
264
+ "&:not(:disabled):hover": {
265
+ background: "$ignite300"
266
+ },
267
+ "&:disabled": {
268
+ backgroundColor: "$gray200"
269
+ }
270
+ },
271
+ secondary: {
272
+ color: "$ignite300",
273
+ border: "2px solid $ignite300",
274
+ "&:not(:disabled):hover": {
275
+ background: "$ignite500",
276
+ color: "$white"
277
+ },
278
+ "&:disabled": {
279
+ color: "$gray200",
280
+ borderColor: "$gray200"
281
+ }
282
+ },
283
+ tertiary: {
284
+ color: "$gray100",
285
+ "&:not(:disabled):hover": {
286
+ background: "$white"
287
+ },
288
+ "&:disabled": {
289
+ color: "$gray600"
290
+ }
291
+ }
292
+ },
293
+ size: {
294
+ sm: {
295
+ height: 38
296
+ },
297
+ md: {
298
+ height: 46
299
+ }
300
+ }
301
+ },
302
+ defaultVariants: {
303
+ variant: "primary",
304
+ size: "md"
305
+ }
306
+ });
307
+ Button.displayName = "Button";
308
+
309
+ // src/components/TextInput/styles.ts
310
+ var TextInputContainer = styled("div", {
311
+ backgroundColor: "$gray900",
312
+ padding: "$4",
313
+ borderRadius: "$sm",
314
+ boxSizing: "border-box",
315
+ border: "2px solid $gray900",
316
+ display: "flex",
317
+ alignItems: "baseline",
318
+ "&:has(input:focus)": {
319
+ borderColor: "$ignite300"
320
+ },
321
+ "&:has(input:disabled)": {
322
+ opacity: 0.5,
323
+ cursor: "not-allowed"
324
+ }
325
+ });
326
+ var Prefix = styled("span", {
327
+ fontFamily: "$default",
328
+ fontSize: "$sm",
329
+ color: "$gray400",
330
+ fontWeight: "regular"
331
+ });
332
+ var Input = styled("input", {
333
+ fontFamily: "$default",
334
+ fontSize: "$sm",
335
+ color: "$white",
336
+ fontWeight: "regular",
337
+ background: "transparent",
338
+ border: 0,
339
+ width: "100%",
340
+ "&:focus": {
341
+ outline: 0
342
+ },
343
+ "&:disabled": {
344
+ cursor: "not-allowed"
345
+ },
346
+ "&:placeholder": {
347
+ color: "$gray400"
348
+ }
349
+ });
350
+
351
+ // src/components/TextInput/index.tsx
352
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
353
+ function TextInput(_a) {
354
+ var _b = _a, { prefix } = _b, props = __objRest(_b, ["prefix"]);
355
+ return /* @__PURE__ */ jsxs2(TextInputContainer, { children: [
356
+ !!prefix && /* @__PURE__ */ jsx2(Prefix, { children: prefix }),
357
+ /* @__PURE__ */ jsx2(Input, __spreadValues({}, props))
358
+ ] });
359
+ }
360
+ TextInput.displayName = "TextInput";
361
+
362
+ // src/components/TextArea.tsx
363
+ var TextArea = styled("textarea", {
364
+ backgroundColor: "$gray900",
365
+ padding: "$4",
366
+ borderRadius: "$sm",
367
+ boxSizing: "border-box",
368
+ border: "2px solid $gray900",
369
+ fontFamily: "$default",
370
+ fontSize: "$sm",
371
+ color: "$white",
372
+ fontWeight: "$regular",
373
+ resize: "vertical",
374
+ minHeight: 80,
375
+ "&:focus": {
376
+ outline: "none",
377
+ borderColor: "$ignite300"
378
+ },
379
+ "&:disabled": {
380
+ opacity: 0.5,
381
+ cursor: "not-allowed"
382
+ },
383
+ "&:placeholder": {
384
+ color: "$gray400"
385
+ }
386
+ });
387
+ TextArea.displayName = "TextArea";
388
+
389
+ // src/components/Checkbox/index.tsx
390
+ import { Check } from "phosphor-react";
391
+
392
+ // src/components/Checkbox/styles.ts
393
+ import * as Checkbox from "@radix-ui/react-checkbox";
394
+ var CheckboxContainer = styled(Checkbox.Root, {
395
+ all: "unset",
396
+ // Como é um botão, all unset tirará borda, background, etc
397
+ width: "$6",
398
+ height: "$6",
399
+ backgroundColor: "$gray900",
400
+ borderRadius: "$xs",
401
+ cursor: "pointer",
402
+ overflow: "hidden",
403
+ boxSizing: "border-box",
404
+ display: "flex",
405
+ justifyContent: "center",
406
+ alignItems: "center",
407
+ border: "2px solid $gray900",
408
+ '&[data-state="checked"]': {
409
+ backgroundColor: "$ignite300"
410
+ },
411
+ "&:focus": {
412
+ border: "2px solid $ignite300"
413
+ }
414
+ });
415
+ var slideIn = keyframes({
416
+ from: {
417
+ transform: "translateY(-100%)"
418
+ },
419
+ to: {
420
+ transform: "translateY(0)"
421
+ }
422
+ });
423
+ var slideOut = keyframes({
424
+ from: {
425
+ transform: "translateY(0)"
426
+ },
427
+ to: {
428
+ transform: "translateY(-100%)"
429
+ }
430
+ });
431
+ var CheckboxIndicator = styled(Checkbox.Indicator, {
432
+ color: "white",
433
+ width: "$4",
434
+ height: "$4",
435
+ '&[data-state="checked"]': {
436
+ animation: `${slideIn} 200ms ease-out`
437
+ },
438
+ '&[data-state="unchecked"]': {
439
+ animation: `${slideOut} 200ms ease-out`
440
+ }
441
+ });
442
+
443
+ // src/components/Checkbox/index.tsx
444
+ import { jsx as jsx3 } from "react/jsx-runtime";
445
+ function Checkbox2(props) {
446
+ return /* @__PURE__ */ jsx3(CheckboxContainer, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx3(CheckboxIndicator, { asChild: true, children: /* @__PURE__ */ jsx3(Check, { weight: "bold" }) }) }));
447
+ }
448
+ Checkbox2.displayName = "Checkbox";
449
+
450
+ // src/components/MultiStep/styles.ts
451
+ var MultistepContainer = styled("div", {});
452
+ var Label = styled(Text, {
453
+ color: "$gray200",
454
+ defaultVariants: {
455
+ size: "xs"
456
+ }
457
+ });
458
+ var Steps = styled("div", {
459
+ display: "grid",
460
+ gap: "$2",
461
+ marginTop: "$1",
462
+ gridTemplateColumns: "repeat(var(--steps-size), 1fr)"
463
+ });
464
+ var Step = styled("div", {
465
+ height: "$1",
466
+ borderRadius: "$px",
467
+ backgroundColor: "$gray600",
468
+ variants: {
469
+ active: {
470
+ true: {
471
+ backgroundColor: "$gray100"
472
+ }
473
+ }
474
+ }
475
+ });
476
+ var Full = styled("div", {});
477
+
478
+ // src/components/MultiStep/index.tsx
479
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
480
+ function MultiStep({ size, currentStep = 1 }) {
481
+ return /* @__PURE__ */ jsxs3(MultistepContainer, { children: [
482
+ /* @__PURE__ */ jsxs3(Label, { children: [
483
+ "Passo ",
484
+ currentStep,
485
+ " de ",
486
+ size
487
+ ] }),
488
+ /* @__PURE__ */ jsx4(Steps, { css: { "--steps-size": size }, children: Array.from({ length: size }, (_, i) => i + 1).map((step) => {
489
+ return /* @__PURE__ */ jsx4(Step, { active: currentStep >= step }, step);
490
+ }) })
491
+ ] });
492
+ }
493
+ MultiStep.displayName = "MultiStep";
494
+ export {
495
+ Avatar2 as Avatar,
496
+ Box,
497
+ Button,
498
+ Checkbox2 as Checkbox,
499
+ Heading,
500
+ MultiStep,
501
+ Text,
502
+ TextArea,
503
+ TextInput
504
+ };
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@giv-igniteui/react",
3
+ "version": "2.0.0",
4
+ "description": "",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "scripts": {
9
+ "build": "tsup src/index.tsx --format esm,cjs --dts --external react",
10
+ "dev": "tsup src/index.tsx --format esm,cjs --dts --watch --external react",
11
+ "lint": "eslint src/**/*.ts* --fix"
12
+ },
13
+ "keywords": [],
14
+ "author": "",
15
+ "license": "MIT",
16
+ "devDependencies": {
17
+ "@giv-igniteui/eslint-config": "*",
18
+ "@giv-igniteui/tokens": "*",
19
+ "@giv-igniteui/ts-config": "*",
20
+ "@types/react": "^19.0.4",
21
+ "@types/react-dom": "^19.0.2",
22
+ "react": "^19.0.0",
23
+ "tsup": "^8.3.5",
24
+ "typescript": "^5.7.2"
25
+ },
26
+ "dependencies": {
27
+ "@radix-ui/react-avatar": "^1.1.2",
28
+ "@radix-ui/react-checkbox": "^1.1.3",
29
+ "@stitches/react": "^1.2.8",
30
+ "phosphor-react": "^1.4.1"
31
+ }
32
+ }
@@ -0,0 +1,18 @@
1
+ import { ComponentProps } from 'react'
2
+ import { AvatarContainer, AvatarImage, AvatarFallback } from './styles'
3
+ import { User } from 'phosphor-react'
4
+
5
+ export interface AvatarProps extends ComponentProps<typeof AvatarImage> {}
6
+
7
+ export function Avatar(props: AvatarProps) {
8
+ return (
9
+ <AvatarContainer>
10
+ <AvatarImage {...props} />
11
+ <AvatarFallback delayMs={600}>
12
+ <User />
13
+ </AvatarFallback>
14
+ </AvatarContainer>
15
+ )
16
+ }
17
+
18
+ Avatar.displayName = 'Avatar'
@@ -0,0 +1,29 @@
1
+ import * as Avatar from '@radix-ui/react-avatar'
2
+ import { styled } from '../../styles'
3
+
4
+ export const AvatarContainer = styled(Avatar.Root, {
5
+ borderRadius: '$full',
6
+ display: 'inline-block',
7
+ width: '$12',
8
+ height: '$12',
9
+ overflow: 'hidden',
10
+ })
11
+ export const AvatarImage = styled(Avatar.Image, {
12
+ width: '100%',
13
+ height: '100%',
14
+ objectFit: 'cover',
15
+ borderRadius: '$full',
16
+ })
17
+ export const AvatarFallback = styled(Avatar.Fallback, {
18
+ width: '100%',
19
+ height: '100%',
20
+ display: 'flex',
21
+ alignItems: 'center',
22
+ justifyContent: 'center',
23
+ backgroundColor: '$gray600',
24
+ color: '$gray800',
25
+ svg: {
26
+ width: '$6',
27
+ height: '$6',
28
+ },
29
+ })
@@ -0,0 +1,12 @@
1
+ import { ComponentProps } from 'react'
2
+ import { styled } from '../styles'
3
+
4
+ export const Box = styled('div', {
5
+ padding: '$4',
6
+ borderRadius: '$md',
7
+ backgroundColor: '$gray800',
8
+ border: '1px solid $gray600',
9
+ })
10
+
11
+ export interface BoxProps extends ComponentProps<typeof Box> {}
12
+ Box.displayName = 'Box'
@@ -0,0 +1,84 @@
1
+ import { ComponentProps, ElementType } from 'react'
2
+ import { styled } from '../styles'
3
+
4
+ export const Button = styled('button', {
5
+ all: 'unset',
6
+ borderRadius: '$sm',
7
+ fontSize: '$sm',
8
+ fontWeight: '$medium',
9
+ fontFamily: '$default',
10
+ textAlign: 'center',
11
+ minWidth: 120,
12
+ boxSizing: 'border-box',
13
+ display: 'flex',
14
+ alignItems: 'center',
15
+ justifyContent: 'center',
16
+ gap: '$2',
17
+ cursor: 'pointer',
18
+ padding: '0 $4',
19
+
20
+ svg: {
21
+ width: '$4',
22
+ height: '$4',
23
+ },
24
+
25
+ '&:disabled': {
26
+ cursor: 'not-allowed',
27
+ },
28
+
29
+ variants: {
30
+ variant: {
31
+ primary: {
32
+ color: '$white',
33
+ background: '$ignite500',
34
+
35
+ '&:not(:disabled):hover': {
36
+ background: '$ignite300',
37
+ },
38
+ '&:disabled': {
39
+ backgroundColor: '$gray200',
40
+ },
41
+ },
42
+ secondary: {
43
+ color: '$ignite300',
44
+ border: '2px solid $ignite300',
45
+ '&:not(:disabled):hover': {
46
+ background: '$ignite500',
47
+ color: '$white',
48
+ },
49
+ '&:disabled': {
50
+ color: '$gray200',
51
+ borderColor: '$gray200',
52
+ },
53
+ },
54
+ tertiary: {
55
+ color: '$gray100',
56
+
57
+ '&:not(:disabled):hover': {
58
+ background: '$white',
59
+ },
60
+ '&:disabled': {
61
+ color: '$gray600',
62
+ },
63
+ },
64
+ },
65
+ size: {
66
+ sm: {
67
+ height: 38,
68
+ },
69
+ md: {
70
+ height: 46,
71
+ },
72
+ },
73
+ },
74
+ defaultVariants: {
75
+ variant: 'primary',
76
+ size: 'md',
77
+ },
78
+ })
79
+
80
+ export interface ButtonProps extends ComponentProps<typeof Button> {
81
+ as?: ElementType
82
+ }
83
+
84
+ Button.displayName = 'Button'
@@ -0,0 +1,20 @@
1
+ import { Check } from 'phosphor-react'
2
+ import { CheckboxContainer, CheckboxIndicator } from './styles'
3
+ import { ComponentProps } from 'react'
4
+
5
+ export interface CheckboxProps
6
+ extends ComponentProps<typeof CheckboxContainer> {}
7
+
8
+ // asChild: Funciona como um elemento filho: assim, CheckboxIndicator não criará um novo elemento na tela
9
+
10
+ export function Checkbox(props: CheckboxProps) {
11
+ return (
12
+ <CheckboxContainer {...props}>
13
+ <CheckboxIndicator asChild>
14
+ <Check weight="bold" />
15
+ </CheckboxIndicator>
16
+ </CheckboxContainer>
17
+ )
18
+ }
19
+
20
+ Checkbox.displayName = 'Checkbox'