@dafaz-ui/react 2.2.2 → 3.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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +653 -14
- package/dist/index.d.ts +653 -14
- package/dist/index.js +384 -30
- package/dist/index.mjs +369 -28
- package/package.json +4 -1
- package/src/components/Box/index.tsx +2 -0
- package/src/components/Box/styles.ts +2 -0
- package/src/components/Button/index.tsx +0 -2
- package/src/components/CheckBox/index.tsx +25 -0
- package/src/components/CheckBox/styles.ts +128 -0
- package/src/components/Heading/index.tsx +0 -2
- package/src/components/Radio/RadioItem/index.tsx +32 -0
- package/src/components/Radio/RadioItem/styles.ts +130 -0
- package/src/components/Radio/index.tsx +29 -0
- package/src/components/Radio/styles.ts +25 -0
- package/src/components/Text/index.tsx +0 -2
- package/src/components/TextArea/index.tsx +19 -0
- package/src/components/TextArea/styles.ts +40 -0
- package/src/components/TextInput/index.tsx +0 -2
- package/src/index.tsx +4 -1
package/dist/index.mjs
CHANGED
@@ -162,6 +162,7 @@ function Box(_a) {
|
|
162
162
|
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
163
163
|
return /* @__PURE__ */ jsx(BoxUI, __spreadProps(__spreadValues({}, props), { children }));
|
164
164
|
}
|
165
|
+
Box.displayName = "Box";
|
165
166
|
|
166
167
|
// src/components/Button/styles.ts
|
167
168
|
var ButtonUI = styled("button", {
|
@@ -267,43 +268,135 @@ function Button(_a) {
|
|
267
268
|
]);
|
268
269
|
return /* @__PURE__ */ jsx2(ButtonUI, __spreadProps(__spreadValues({ variant, size }, props), { children }));
|
269
270
|
}
|
270
|
-
ButtonUI.displayName = "Button";
|
271
271
|
|
272
|
-
// src/components/
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
272
|
+
// src/components/CheckBox/styles.ts
|
273
|
+
import * as Checkbox from "@radix-ui/react-checkbox";
|
274
|
+
var CheckBoxUI = styled(Checkbox.Root, {
|
275
|
+
all: "unset",
|
276
|
+
borderRadius: "$md",
|
277
|
+
lineHeight: 0,
|
278
|
+
cursor: "pointer",
|
279
|
+
overflow: "hidden",
|
280
|
+
boxSizing: "border-box",
|
281
|
+
display: "flex",
|
282
|
+
justifyContent: "center",
|
283
|
+
alignItems: "center",
|
284
|
+
borderBottom: "2px solid $dafaz600",
|
285
|
+
transition: "border 0.1s linear",
|
286
|
+
'&:focus,&[data-state="checked"]': {
|
287
|
+
backgroundColor: "$dafaz600",
|
288
|
+
borderColor: "$dafaz600"
|
289
|
+
},
|
290
|
+
'&[data-state="unchecked"]': {
|
291
|
+
backgroundColor: "$gray800"
|
292
|
+
},
|
293
|
+
"&:hover": {
|
294
|
+
borderColor: "$dafaz600"
|
295
|
+
},
|
296
|
+
variants: {
|
297
|
+
size: {
|
298
|
+
lg: {
|
299
|
+
width: "$7",
|
300
|
+
height: "$7",
|
301
|
+
borderBottom: "2px solid $dafaz600"
|
302
|
+
},
|
303
|
+
md: {
|
304
|
+
width: "$5",
|
305
|
+
height: "$5",
|
306
|
+
borderBottom: "1px solid $dafaz600"
|
307
|
+
},
|
308
|
+
sm: {
|
309
|
+
width: "$5",
|
310
|
+
height: "$5",
|
311
|
+
borderBottom: "0.5px solid $dafaz600"
|
312
|
+
}
|
313
|
+
}
|
314
|
+
},
|
315
|
+
defaultVariants: {
|
316
|
+
size: "lg"
|
317
|
+
}
|
318
|
+
});
|
319
|
+
var slideIn = keyframes({
|
320
|
+
from: { transform: "translateY(-100%)" },
|
321
|
+
to: { transform: "translateY(0)" }
|
322
|
+
});
|
323
|
+
var slideOut = keyframes({
|
324
|
+
from: { transform: "translateY(0)" },
|
325
|
+
to: { transform: "translateY(100%)" }
|
326
|
+
});
|
327
|
+
var CheckBoxIndicator = styled(Checkbox.Indicator, {
|
277
328
|
color: "$white",
|
329
|
+
'&[data-state="checked"]': {
|
330
|
+
animation: `${slideIn} 200ms ease-out`
|
331
|
+
},
|
332
|
+
'&[data-state="unchecked"]': {
|
333
|
+
animation: `${slideOut} 200ms ease-out`
|
334
|
+
},
|
278
335
|
variants: {
|
279
336
|
size: {
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
337
|
+
lg: {
|
338
|
+
width: "$5",
|
339
|
+
height: "$5"
|
340
|
+
},
|
341
|
+
md: {
|
342
|
+
width: "$4",
|
343
|
+
height: "$4"
|
344
|
+
},
|
345
|
+
sm: {
|
346
|
+
width: "$3",
|
347
|
+
height: "$3"
|
348
|
+
}
|
287
349
|
}
|
288
350
|
},
|
289
351
|
defaultVariants: {
|
290
|
-
size: "
|
352
|
+
size: "lg"
|
353
|
+
}
|
354
|
+
});
|
355
|
+
var Label = styled("label", {
|
356
|
+
fontFamily: "$app",
|
357
|
+
lineHeight: 0,
|
358
|
+
color: "$white",
|
359
|
+
fontWeight: "$regular",
|
360
|
+
cursor: "pointer",
|
361
|
+
display: "flex",
|
362
|
+
gap: "$2",
|
363
|
+
alignItems: "center",
|
364
|
+
variants: {
|
365
|
+
size: {
|
366
|
+
lg: {
|
367
|
+
fontSize: "$xl"
|
368
|
+
},
|
369
|
+
md: {
|
370
|
+
fontSize: "$lg"
|
371
|
+
},
|
372
|
+
sm: {
|
373
|
+
fontSize: "$md"
|
374
|
+
}
|
375
|
+
}
|
376
|
+
},
|
377
|
+
defaultVariants: {
|
378
|
+
size: "lg"
|
291
379
|
}
|
292
380
|
});
|
293
381
|
|
294
|
-
// src/components/
|
295
|
-
import {
|
296
|
-
|
382
|
+
// src/components/CheckBox/index.tsx
|
383
|
+
import { Check } from "@phosphor-icons/react";
|
384
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
385
|
+
function CheckBox(_a) {
|
297
386
|
var _b = _a, {
|
298
|
-
|
299
|
-
|
387
|
+
id,
|
388
|
+
label,
|
389
|
+
size
|
300
390
|
} = _b, props = __objRest(_b, [
|
301
|
-
"
|
391
|
+
"id",
|
392
|
+
"label",
|
302
393
|
"size"
|
303
394
|
]);
|
304
|
-
return /* @__PURE__ */
|
395
|
+
return /* @__PURE__ */ jsxs(Label, { htmlFor: id, size, children: [
|
396
|
+
/* @__PURE__ */ jsx3(CheckBoxUI, __spreadProps(__spreadValues({ id }, props), { size, children: /* @__PURE__ */ jsx3(CheckBoxIndicator, { asChild: true, size, children: /* @__PURE__ */ jsx3(Check, { weight: "bold" }) }) })),
|
397
|
+
label
|
398
|
+
] });
|
305
399
|
}
|
306
|
-
Text.displayName = "Text";
|
307
400
|
|
308
401
|
// src/components/Heading/styles.ts
|
309
402
|
var HeadingUI = styled("h2", {
|
@@ -339,7 +432,253 @@ function Heading(_a) {
|
|
339
432
|
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
340
433
|
return /* @__PURE__ */ jsx4(HeadingUI, __spreadProps(__spreadValues({}, props), { children }));
|
341
434
|
}
|
342
|
-
|
435
|
+
|
436
|
+
// src/components/Radio/styles.ts
|
437
|
+
import * as RadioGroup from "@radix-ui/react-radio-group";
|
438
|
+
var RadioUI = styled(RadioGroup.Root, {
|
439
|
+
all: "unset",
|
440
|
+
display: "flex",
|
441
|
+
flexDirection: "column",
|
442
|
+
gap: "$4",
|
443
|
+
variants: {
|
444
|
+
size: {
|
445
|
+
lg: {},
|
446
|
+
md: {},
|
447
|
+
sm: {}
|
448
|
+
}
|
449
|
+
},
|
450
|
+
defaultVariants: {
|
451
|
+
size: "lg"
|
452
|
+
}
|
453
|
+
});
|
454
|
+
|
455
|
+
// src/components/Radio/RadioItem/index.tsx
|
456
|
+
import { Check as Check2 } from "@phosphor-icons/react";
|
457
|
+
|
458
|
+
// src/components/Radio/RadioItem/styles.ts
|
459
|
+
import * as RadioGroup2 from "@radix-ui/react-radio-group";
|
460
|
+
var RadioItemContainer = styled("div", {
|
461
|
+
display: "flex",
|
462
|
+
alignItems: "center",
|
463
|
+
gap: "$2"
|
464
|
+
});
|
465
|
+
var RadioItemUI = styled(RadioGroup2.Item, {
|
466
|
+
all: "unset",
|
467
|
+
borderRadius: "$full",
|
468
|
+
lineHeight: 0,
|
469
|
+
cursor: "pointer",
|
470
|
+
overflow: "hidden",
|
471
|
+
boxSizing: "border-box",
|
472
|
+
display: "flex",
|
473
|
+
justifyContent: "center",
|
474
|
+
alignItems: "center",
|
475
|
+
borderBottom: "2px solid $dafaz600",
|
476
|
+
transition: "border 0.1s linear",
|
477
|
+
'&:focus,&[data-state="checked"]': {
|
478
|
+
backgroundColor: "$dafaz600",
|
479
|
+
borderColor: "$dafaz600"
|
480
|
+
},
|
481
|
+
'&[data-state="unchecked"]': {
|
482
|
+
backgroundColor: "$gray800"
|
483
|
+
},
|
484
|
+
"&:hover": {
|
485
|
+
borderColor: "$dafaz600"
|
486
|
+
},
|
487
|
+
variants: {
|
488
|
+
size: {
|
489
|
+
lg: {
|
490
|
+
width: "$7",
|
491
|
+
height: "$7",
|
492
|
+
borderBottom: "2px solid $dafaz600"
|
493
|
+
},
|
494
|
+
md: {
|
495
|
+
width: "$5",
|
496
|
+
height: "$5",
|
497
|
+
borderBottom: "1px solid $dafaz600"
|
498
|
+
},
|
499
|
+
sm: {
|
500
|
+
width: "$5",
|
501
|
+
height: "$5",
|
502
|
+
borderBottom: "0.5px solid $dafaz600"
|
503
|
+
}
|
504
|
+
}
|
505
|
+
},
|
506
|
+
defaultVariants: {
|
507
|
+
size: "lg"
|
508
|
+
}
|
509
|
+
});
|
510
|
+
var slideIn2 = keyframes({
|
511
|
+
from: { transform: "translateY(-100%)" },
|
512
|
+
to: { transform: "translateY(0)" }
|
513
|
+
});
|
514
|
+
var slideOut2 = keyframes({
|
515
|
+
from: { transform: "translateY(0)" },
|
516
|
+
to: { transform: "translateY(100%)" }
|
517
|
+
});
|
518
|
+
var RadioIndicator = styled(RadioGroup2.Indicator, {
|
519
|
+
color: "$white",
|
520
|
+
'&[data-state="checked"]': {
|
521
|
+
animation: `${slideIn2} 200ms ease-out`
|
522
|
+
},
|
523
|
+
'&[data-state="unchecked"]': {
|
524
|
+
animation: `${slideOut2} 200ms ease-out`
|
525
|
+
},
|
526
|
+
variants: {
|
527
|
+
size: {
|
528
|
+
lg: {
|
529
|
+
width: "$5",
|
530
|
+
height: "$5"
|
531
|
+
},
|
532
|
+
md: {
|
533
|
+
width: "$4",
|
534
|
+
height: "$4"
|
535
|
+
},
|
536
|
+
sm: {
|
537
|
+
width: "$3",
|
538
|
+
height: "$3"
|
539
|
+
}
|
540
|
+
}
|
541
|
+
},
|
542
|
+
defaultVariants: {
|
543
|
+
size: "lg"
|
544
|
+
}
|
545
|
+
});
|
546
|
+
var Label2 = styled("label", {
|
547
|
+
fontFamily: "$app",
|
548
|
+
lineHeight: 0,
|
549
|
+
color: "$white",
|
550
|
+
fontWeight: "$regular",
|
551
|
+
cursor: "pointer",
|
552
|
+
variants: {
|
553
|
+
size: {
|
554
|
+
lg: {
|
555
|
+
fontSize: "$xl"
|
556
|
+
},
|
557
|
+
md: {
|
558
|
+
fontSize: "$lg"
|
559
|
+
},
|
560
|
+
sm: {
|
561
|
+
fontSize: "$md"
|
562
|
+
}
|
563
|
+
}
|
564
|
+
},
|
565
|
+
defaultVariants: {
|
566
|
+
size: "lg"
|
567
|
+
}
|
568
|
+
});
|
569
|
+
|
570
|
+
// src/components/Radio/RadioItem/index.tsx
|
571
|
+
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
572
|
+
function RadioItem(_a) {
|
573
|
+
var _b = _a, {
|
574
|
+
label,
|
575
|
+
id,
|
576
|
+
size
|
577
|
+
} = _b, props = __objRest(_b, [
|
578
|
+
"label",
|
579
|
+
"id",
|
580
|
+
"size"
|
581
|
+
]);
|
582
|
+
return /* @__PURE__ */ jsxs2(RadioItemContainer, { children: [
|
583
|
+
/* @__PURE__ */ jsx5(RadioItemUI, __spreadProps(__spreadValues({ id }, props), { size, children: /* @__PURE__ */ jsx5(RadioIndicator, { asChild: true, size, children: /* @__PURE__ */ jsx5(Check2, { weight: "bold" }) }) })),
|
584
|
+
/* @__PURE__ */ jsx5(Label2, { htmlFor: id, size, children: label })
|
585
|
+
] }, id);
|
586
|
+
}
|
587
|
+
|
588
|
+
// src/components/Radio/index.tsx
|
589
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
590
|
+
function Radio(_a) {
|
591
|
+
var _b = _a, { items, size } = _b, props = __objRest(_b, ["items", "size"]);
|
592
|
+
return /* @__PURE__ */ jsx6(RadioUI, __spreadProps(__spreadValues({}, props), { children: items.map((item) => {
|
593
|
+
return /* @__PURE__ */ jsx6(
|
594
|
+
RadioItem,
|
595
|
+
{
|
596
|
+
id: item.id,
|
597
|
+
label: item.label,
|
598
|
+
value: item.value,
|
599
|
+
size
|
600
|
+
}
|
601
|
+
);
|
602
|
+
}) }));
|
603
|
+
}
|
604
|
+
|
605
|
+
// src/components/Text/styles.ts
|
606
|
+
var TextUI = styled("p", {
|
607
|
+
fontFamily: "$web",
|
608
|
+
lineHeight: "$base",
|
609
|
+
margin: 0,
|
610
|
+
color: "$white",
|
611
|
+
variants: {
|
612
|
+
size: {
|
613
|
+
xxs: { fontSize: "$xxs" },
|
614
|
+
xs: { fontSize: "$xs" },
|
615
|
+
sm: { fontSize: "$sm" },
|
616
|
+
md: { fontSize: "$md" },
|
617
|
+
lg: { fontSize: "$lg" },
|
618
|
+
xl: { fontSize: "$xl" },
|
619
|
+
"2xl": { fontSize: "$2xl" }
|
620
|
+
}
|
621
|
+
},
|
622
|
+
defaultVariants: {
|
623
|
+
size: "md"
|
624
|
+
}
|
625
|
+
});
|
626
|
+
|
627
|
+
// src/components/Text/index.tsx
|
628
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
629
|
+
function Text(_a) {
|
630
|
+
var _b = _a, {
|
631
|
+
children,
|
632
|
+
size = "md"
|
633
|
+
} = _b, props = __objRest(_b, [
|
634
|
+
"children",
|
635
|
+
"size"
|
636
|
+
]);
|
637
|
+
return /* @__PURE__ */ jsx7(TextUI, __spreadProps(__spreadValues({ size }, props), { children }));
|
638
|
+
}
|
639
|
+
|
640
|
+
// src/components/TextArea/styles.ts
|
641
|
+
var TextAreaUI = styled("textarea", {
|
642
|
+
fontFamily: "$app",
|
643
|
+
fontSize: "$lg",
|
644
|
+
color: "$white",
|
645
|
+
fontWeight: "$regular",
|
646
|
+
resize: "vertical",
|
647
|
+
border: "0.7px solid $gray400",
|
648
|
+
margin: 0,
|
649
|
+
backgroundColor: "transparent",
|
650
|
+
borderBottom: "2px solid $dafaz600",
|
651
|
+
borderRadius: "$md",
|
652
|
+
boxSizing: "border-box",
|
653
|
+
display: "flex",
|
654
|
+
alignItems: "baseline",
|
655
|
+
width: "100%",
|
656
|
+
padding: "$1 $2",
|
657
|
+
"&:focus": {
|
658
|
+
outline: 0
|
659
|
+
},
|
660
|
+
"&:disabled": {
|
661
|
+
opacity: 0.5,
|
662
|
+
cursor: "not-allowed"
|
663
|
+
},
|
664
|
+
"&::placeholder": {
|
665
|
+
fontSize: "$xl",
|
666
|
+
fontWeight: "$regular",
|
667
|
+
color: "$white",
|
668
|
+
opacity: 0.75
|
669
|
+
}
|
670
|
+
});
|
671
|
+
|
672
|
+
// src/components/TextArea/index.tsx
|
673
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
674
|
+
function TextArea(_a) {
|
675
|
+
var _b = _a, {
|
676
|
+
children
|
677
|
+
} = _b, props = __objRest(_b, [
|
678
|
+
"children"
|
679
|
+
]);
|
680
|
+
return /* @__PURE__ */ jsx8(TextAreaUI, __spreadProps(__spreadValues({ rows: 3 }, props), { children }));
|
681
|
+
}
|
343
682
|
|
344
683
|
// src/components/TextInput/index.tsx
|
345
684
|
import {
|
@@ -409,7 +748,7 @@ var Sufix = styled("span", {
|
|
409
748
|
});
|
410
749
|
|
411
750
|
// src/components/TextInput/index.tsx
|
412
|
-
import { jsx as
|
751
|
+
import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
|
413
752
|
var TextInput = forwardRef(
|
414
753
|
(_a, ref) => {
|
415
754
|
var _b = _a, {
|
@@ -431,18 +770,20 @@ var TextInput = forwardRef(
|
|
431
770
|
}
|
432
771
|
}
|
433
772
|
}
|
434
|
-
return /* @__PURE__ */
|
435
|
-
/* @__PURE__ */
|
436
|
-
!hiddenOptional && /* @__PURE__ */
|
773
|
+
return /* @__PURE__ */ jsxs3(InputContainer, { withShadow, children: [
|
774
|
+
/* @__PURE__ */ jsx9(InputUI, __spreadValues({ ref, onChange: handleOnChange }, props)),
|
775
|
+
!hiddenOptional && /* @__PURE__ */ jsx9(Sufix, { style: { marginLeft: `-${requiredText.length / 2}rem` }, children: requiredText })
|
437
776
|
] });
|
438
777
|
}
|
439
778
|
);
|
440
|
-
TextInput.displayName = "Input";
|
441
779
|
export {
|
442
780
|
Box,
|
443
781
|
Button,
|
782
|
+
CheckBox,
|
444
783
|
Heading,
|
784
|
+
Radio,
|
445
785
|
Text,
|
786
|
+
TextArea,
|
446
787
|
TextInput,
|
447
788
|
config,
|
448
789
|
createTheme,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dafaz-ui/react",
|
3
|
-
"version": "
|
3
|
+
"version": "3.0.1",
|
4
4
|
"main": "./dist/index.js",
|
5
5
|
"module": "./dist/index.mjs",
|
6
6
|
"types": "./dist/index.d.ts",
|
@@ -26,6 +26,9 @@
|
|
26
26
|
"typescript": "^5.6.3"
|
27
27
|
},
|
28
28
|
"dependencies": {
|
29
|
+
"@phosphor-icons/react": "^2.1.7",
|
30
|
+
"@radix-ui/react-checkbox": "^1.1.2",
|
31
|
+
"@radix-ui/react-radio-group": "^1.2.1",
|
29
32
|
"@stitches/react": "^1.2.8"
|
30
33
|
}
|
31
34
|
}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import type { CSS } from '@stitches/react'
|
1
2
|
import { styled } from '../../styles'
|
2
3
|
import type { ComponentProps, ElementType } from 'react'
|
3
4
|
|
@@ -32,4 +33,5 @@ export interface BoxUIProps extends ComponentProps<typeof BoxUI> {
|
|
32
33
|
as?: ElementType
|
33
34
|
stretch?: boolean
|
34
35
|
dark?: boolean
|
36
|
+
css?: CSS
|
35
37
|
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { CheckBoxIndicator, CheckBoxUI, Label, CheckboxIUProps } from './styles'
|
2
|
+
import { Check } from '@phosphor-icons/react'
|
3
|
+
|
4
|
+
interface CheckboxProps {
|
5
|
+
id: string
|
6
|
+
label: string
|
7
|
+
}
|
8
|
+
|
9
|
+
export function CheckBox({
|
10
|
+
id,
|
11
|
+
label,
|
12
|
+
size,
|
13
|
+
...props
|
14
|
+
}: CheckboxIUProps & CheckboxProps) {
|
15
|
+
return (
|
16
|
+
<Label htmlFor={id} size={size}>
|
17
|
+
<CheckBoxUI id={id} {...props} size={size}>
|
18
|
+
<CheckBoxIndicator asChild size={size}>
|
19
|
+
<Check weight="bold" />
|
20
|
+
</CheckBoxIndicator>
|
21
|
+
</CheckBoxUI>
|
22
|
+
{label}
|
23
|
+
</Label>
|
24
|
+
)
|
25
|
+
}
|
@@ -0,0 +1,128 @@
|
|
1
|
+
import * as Checkbox from '@radix-ui/react-checkbox'
|
2
|
+
import { styled, keyframes } from '../../styles'
|
3
|
+
import type { ComponentProps } from 'react'
|
4
|
+
|
5
|
+
export const CheckBoxUI = styled(Checkbox.Root, {
|
6
|
+
all: 'unset',
|
7
|
+
borderRadius: '$md',
|
8
|
+
lineHeight: 0,
|
9
|
+
cursor: 'pointer',
|
10
|
+
overflow: 'hidden',
|
11
|
+
boxSizing: 'border-box',
|
12
|
+
display: 'flex',
|
13
|
+
justifyContent: 'center',
|
14
|
+
alignItems: 'center',
|
15
|
+
borderBottom: '2px solid $dafaz600',
|
16
|
+
transition: 'border 0.1s linear',
|
17
|
+
|
18
|
+
'&:focus,&[data-state="checked"]': {
|
19
|
+
backgroundColor: '$dafaz600',
|
20
|
+
borderColor: '$dafaz600',
|
21
|
+
},
|
22
|
+
|
23
|
+
'&[data-state="unchecked"]': {
|
24
|
+
backgroundColor: '$gray800',
|
25
|
+
},
|
26
|
+
|
27
|
+
'&:hover': {
|
28
|
+
borderColor: '$dafaz600',
|
29
|
+
},
|
30
|
+
|
31
|
+
variants: {
|
32
|
+
size: {
|
33
|
+
lg: {
|
34
|
+
width: '$7',
|
35
|
+
height: '$7',
|
36
|
+
borderBottom: '2px solid $dafaz600',
|
37
|
+
},
|
38
|
+
md: {
|
39
|
+
width: '$5',
|
40
|
+
height: '$5',
|
41
|
+
borderBottom: '1px solid $dafaz600',
|
42
|
+
},
|
43
|
+
sm: {
|
44
|
+
width: '$5',
|
45
|
+
height: '$5',
|
46
|
+
borderBottom: '0.5px solid $dafaz600',
|
47
|
+
},
|
48
|
+
},
|
49
|
+
},
|
50
|
+
defaultVariants: {
|
51
|
+
size: 'lg',
|
52
|
+
},
|
53
|
+
})
|
54
|
+
|
55
|
+
const slideIn = keyframes({
|
56
|
+
from: { transform: 'translateY(-100%)' },
|
57
|
+
to: { transform: 'translateY(0)' },
|
58
|
+
})
|
59
|
+
|
60
|
+
const slideOut = keyframes({
|
61
|
+
from: { transform: 'translateY(0)' },
|
62
|
+
to: { transform: 'translateY(100%)' },
|
63
|
+
})
|
64
|
+
|
65
|
+
export const CheckBoxIndicator = styled(Checkbox.Indicator, {
|
66
|
+
color: '$white',
|
67
|
+
|
68
|
+
'&[data-state="checked"]': {
|
69
|
+
animation: `${slideIn} 200ms ease-out`,
|
70
|
+
},
|
71
|
+
|
72
|
+
'&[data-state="unchecked"]': {
|
73
|
+
animation: `${slideOut} 200ms ease-out`,
|
74
|
+
},
|
75
|
+
|
76
|
+
variants: {
|
77
|
+
size: {
|
78
|
+
lg: {
|
79
|
+
width: '$5',
|
80
|
+
height: '$5',
|
81
|
+
},
|
82
|
+
md: {
|
83
|
+
width: '$4',
|
84
|
+
height: '$4',
|
85
|
+
},
|
86
|
+
sm: {
|
87
|
+
width: '$3',
|
88
|
+
height: '$3',
|
89
|
+
},
|
90
|
+
},
|
91
|
+
},
|
92
|
+
defaultVariants: {
|
93
|
+
size: 'lg',
|
94
|
+
},
|
95
|
+
})
|
96
|
+
|
97
|
+
export const Label = styled('label', {
|
98
|
+
fontFamily: '$app',
|
99
|
+
lineHeight: 0,
|
100
|
+
color: '$white',
|
101
|
+
fontWeight: '$regular',
|
102
|
+
cursor: 'pointer',
|
103
|
+
|
104
|
+
display: 'flex',
|
105
|
+
gap: '$2',
|
106
|
+
alignItems: 'center',
|
107
|
+
|
108
|
+
variants: {
|
109
|
+
size: {
|
110
|
+
lg: {
|
111
|
+
fontSize: '$xl',
|
112
|
+
},
|
113
|
+
md: {
|
114
|
+
fontSize: '$lg',
|
115
|
+
},
|
116
|
+
sm: {
|
117
|
+
fontSize: '$md',
|
118
|
+
},
|
119
|
+
},
|
120
|
+
},
|
121
|
+
defaultVariants: {
|
122
|
+
size: 'lg',
|
123
|
+
},
|
124
|
+
})
|
125
|
+
|
126
|
+
export interface CheckboxIUProps extends ComponentProps<typeof CheckBoxUI> {
|
127
|
+
size?: 'sm' | 'md' | 'lg'
|
128
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { Check } from '@phosphor-icons/react'
|
2
|
+
import {
|
3
|
+
Label,
|
4
|
+
RadioIndicator,
|
5
|
+
RadioItemContainer,
|
6
|
+
RadioItemUI,
|
7
|
+
type RadioItemUIProps,
|
8
|
+
} from './styles'
|
9
|
+
|
10
|
+
interface RadioItemProps {
|
11
|
+
label: string
|
12
|
+
}
|
13
|
+
|
14
|
+
export function RadioItem({
|
15
|
+
label,
|
16
|
+
id,
|
17
|
+
size,
|
18
|
+
...props
|
19
|
+
}: RadioItemProps & RadioItemUIProps) {
|
20
|
+
return (
|
21
|
+
<RadioItemContainer key={id}>
|
22
|
+
<RadioItemUI id={id} {...props} size={size}>
|
23
|
+
<RadioIndicator asChild size={size}>
|
24
|
+
<Check weight="bold" />
|
25
|
+
</RadioIndicator>
|
26
|
+
</RadioItemUI>
|
27
|
+
<Label htmlFor={id} size={size}>
|
28
|
+
{label}
|
29
|
+
</Label>
|
30
|
+
</RadioItemContainer>
|
31
|
+
)
|
32
|
+
}
|