@dafaz-ui/react 2.2.2 → 3.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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +6 -0
- package/dist/index.d.mts +660 -12
- package/dist/index.d.ts +660 -12
- package/dist/index.js +387 -28
- package/dist/index.mjs +372 -26
- package/package.json +4 -1
- package/src/components/Box/index.tsx +2 -0
- package/src/components/Box/styles.ts +2 -0
- package/src/components/CheckBox/index.tsx +25 -0
- package/src/components/CheckBox/styles.ts +128 -0
- 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/TextArea/index.tsx +21 -0
- package/src/components/TextArea/styles.ts +40 -0
- package/src/components/TextInput/index.tsx +1 -1
- 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", {
|
@@ -269,41 +270,134 @@ function Button(_a) {
|
|
269
270
|
}
|
270
271
|
ButtonUI.displayName = "Button";
|
271
272
|
|
272
|
-
// src/components/
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
273
|
+
// src/components/CheckBox/styles.ts
|
274
|
+
import * as Checkbox from "@radix-ui/react-checkbox";
|
275
|
+
var CheckBoxUI = styled(Checkbox.Root, {
|
276
|
+
all: "unset",
|
277
|
+
borderRadius: "$md",
|
278
|
+
lineHeight: 0,
|
279
|
+
cursor: "pointer",
|
280
|
+
overflow: "hidden",
|
281
|
+
boxSizing: "border-box",
|
282
|
+
display: "flex",
|
283
|
+
justifyContent: "center",
|
284
|
+
alignItems: "center",
|
285
|
+
borderBottom: "2px solid $dafaz600",
|
286
|
+
transition: "border 0.1s linear",
|
287
|
+
'&:focus,&[data-state="checked"]': {
|
288
|
+
backgroundColor: "$dafaz600",
|
289
|
+
borderColor: "$dafaz600"
|
290
|
+
},
|
291
|
+
'&[data-state="unchecked"]': {
|
292
|
+
backgroundColor: "$gray800"
|
293
|
+
},
|
294
|
+
"&:hover": {
|
295
|
+
borderColor: "$dafaz600"
|
296
|
+
},
|
297
|
+
variants: {
|
298
|
+
size: {
|
299
|
+
lg: {
|
300
|
+
width: "$7",
|
301
|
+
height: "$7",
|
302
|
+
borderBottom: "2px solid $dafaz600"
|
303
|
+
},
|
304
|
+
md: {
|
305
|
+
width: "$5",
|
306
|
+
height: "$5",
|
307
|
+
borderBottom: "1px solid $dafaz600"
|
308
|
+
},
|
309
|
+
sm: {
|
310
|
+
width: "$5",
|
311
|
+
height: "$5",
|
312
|
+
borderBottom: "0.5px solid $dafaz600"
|
313
|
+
}
|
314
|
+
}
|
315
|
+
},
|
316
|
+
defaultVariants: {
|
317
|
+
size: "lg"
|
318
|
+
}
|
319
|
+
});
|
320
|
+
var slideIn = keyframes({
|
321
|
+
from: { transform: "translateY(-100%)" },
|
322
|
+
to: { transform: "translateY(0)" }
|
323
|
+
});
|
324
|
+
var slideOut = keyframes({
|
325
|
+
from: { transform: "translateY(0)" },
|
326
|
+
to: { transform: "translateY(100%)" }
|
327
|
+
});
|
328
|
+
var CheckBoxIndicator = styled(Checkbox.Indicator, {
|
277
329
|
color: "$white",
|
330
|
+
'&[data-state="checked"]': {
|
331
|
+
animation: `${slideIn} 200ms ease-out`
|
332
|
+
},
|
333
|
+
'&[data-state="unchecked"]': {
|
334
|
+
animation: `${slideOut} 200ms ease-out`
|
335
|
+
},
|
278
336
|
variants: {
|
279
337
|
size: {
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
338
|
+
lg: {
|
339
|
+
width: "$5",
|
340
|
+
height: "$5"
|
341
|
+
},
|
342
|
+
md: {
|
343
|
+
width: "$4",
|
344
|
+
height: "$4"
|
345
|
+
},
|
346
|
+
sm: {
|
347
|
+
width: "$3",
|
348
|
+
height: "$3"
|
349
|
+
}
|
287
350
|
}
|
288
351
|
},
|
289
352
|
defaultVariants: {
|
290
|
-
size: "
|
353
|
+
size: "lg"
|
354
|
+
}
|
355
|
+
});
|
356
|
+
var Label = styled("label", {
|
357
|
+
fontFamily: "$app",
|
358
|
+
lineHeight: 0,
|
359
|
+
color: "$white",
|
360
|
+
fontWeight: "$regular",
|
361
|
+
cursor: "pointer",
|
362
|
+
display: "flex",
|
363
|
+
gap: "$2",
|
364
|
+
alignItems: "center",
|
365
|
+
variants: {
|
366
|
+
size: {
|
367
|
+
lg: {
|
368
|
+
fontSize: "$xl"
|
369
|
+
},
|
370
|
+
md: {
|
371
|
+
fontSize: "$lg"
|
372
|
+
},
|
373
|
+
sm: {
|
374
|
+
fontSize: "$md"
|
375
|
+
}
|
376
|
+
}
|
377
|
+
},
|
378
|
+
defaultVariants: {
|
379
|
+
size: "lg"
|
291
380
|
}
|
292
381
|
});
|
293
382
|
|
294
|
-
// src/components/
|
295
|
-
import {
|
296
|
-
|
383
|
+
// src/components/CheckBox/index.tsx
|
384
|
+
import { Check } from "@phosphor-icons/react";
|
385
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
386
|
+
function CheckBox(_a) {
|
297
387
|
var _b = _a, {
|
298
|
-
|
299
|
-
|
388
|
+
id,
|
389
|
+
label,
|
390
|
+
size
|
300
391
|
} = _b, props = __objRest(_b, [
|
301
|
-
"
|
392
|
+
"id",
|
393
|
+
"label",
|
302
394
|
"size"
|
303
395
|
]);
|
304
|
-
return /* @__PURE__ */
|
396
|
+
return /* @__PURE__ */ jsxs(Label, { htmlFor: id, size, children: [
|
397
|
+
/* @__PURE__ */ jsx3(CheckBoxUI, __spreadProps(__spreadValues({ id }, props), { size, children: /* @__PURE__ */ jsx3(CheckBoxIndicator, { asChild: true, size, children: /* @__PURE__ */ jsx3(Check, { weight: "bold" }) }) })),
|
398
|
+
label
|
399
|
+
] });
|
305
400
|
}
|
306
|
-
Text.displayName = "Text";
|
307
401
|
|
308
402
|
// src/components/Heading/styles.ts
|
309
403
|
var HeadingUI = styled("h2", {
|
@@ -341,6 +435,255 @@ function Heading(_a) {
|
|
341
435
|
}
|
342
436
|
Heading.displayName = "Heading";
|
343
437
|
|
438
|
+
// src/components/Radio/styles.ts
|
439
|
+
import * as RadioGroup from "@radix-ui/react-radio-group";
|
440
|
+
var RadioUI = styled(RadioGroup.Root, {
|
441
|
+
all: "unset",
|
442
|
+
display: "flex",
|
443
|
+
flexDirection: "column",
|
444
|
+
gap: "$4",
|
445
|
+
variants: {
|
446
|
+
size: {
|
447
|
+
lg: {},
|
448
|
+
md: {},
|
449
|
+
sm: {}
|
450
|
+
}
|
451
|
+
},
|
452
|
+
defaultVariants: {
|
453
|
+
size: "lg"
|
454
|
+
}
|
455
|
+
});
|
456
|
+
|
457
|
+
// src/components/Radio/RadioItem/index.tsx
|
458
|
+
import { Check as Check2 } from "@phosphor-icons/react";
|
459
|
+
|
460
|
+
// src/components/Radio/RadioItem/styles.ts
|
461
|
+
import * as RadioGroup2 from "@radix-ui/react-radio-group";
|
462
|
+
var RadioItemContainer = styled("div", {
|
463
|
+
display: "flex",
|
464
|
+
alignItems: "center",
|
465
|
+
gap: "$2"
|
466
|
+
});
|
467
|
+
var RadioItemUI = styled(RadioGroup2.Item, {
|
468
|
+
all: "unset",
|
469
|
+
borderRadius: "$full",
|
470
|
+
lineHeight: 0,
|
471
|
+
cursor: "pointer",
|
472
|
+
overflow: "hidden",
|
473
|
+
boxSizing: "border-box",
|
474
|
+
display: "flex",
|
475
|
+
justifyContent: "center",
|
476
|
+
alignItems: "center",
|
477
|
+
borderBottom: "2px solid $dafaz600",
|
478
|
+
transition: "border 0.1s linear",
|
479
|
+
'&:focus,&[data-state="checked"]': {
|
480
|
+
backgroundColor: "$dafaz600",
|
481
|
+
borderColor: "$dafaz600"
|
482
|
+
},
|
483
|
+
'&[data-state="unchecked"]': {
|
484
|
+
backgroundColor: "$gray800"
|
485
|
+
},
|
486
|
+
"&:hover": {
|
487
|
+
borderColor: "$dafaz600"
|
488
|
+
},
|
489
|
+
variants: {
|
490
|
+
size: {
|
491
|
+
lg: {
|
492
|
+
width: "$7",
|
493
|
+
height: "$7",
|
494
|
+
borderBottom: "2px solid $dafaz600"
|
495
|
+
},
|
496
|
+
md: {
|
497
|
+
width: "$5",
|
498
|
+
height: "$5",
|
499
|
+
borderBottom: "1px solid $dafaz600"
|
500
|
+
},
|
501
|
+
sm: {
|
502
|
+
width: "$5",
|
503
|
+
height: "$5",
|
504
|
+
borderBottom: "0.5px solid $dafaz600"
|
505
|
+
}
|
506
|
+
}
|
507
|
+
},
|
508
|
+
defaultVariants: {
|
509
|
+
size: "lg"
|
510
|
+
}
|
511
|
+
});
|
512
|
+
var slideIn2 = keyframes({
|
513
|
+
from: { transform: "translateY(-100%)" },
|
514
|
+
to: { transform: "translateY(0)" }
|
515
|
+
});
|
516
|
+
var slideOut2 = keyframes({
|
517
|
+
from: { transform: "translateY(0)" },
|
518
|
+
to: { transform: "translateY(100%)" }
|
519
|
+
});
|
520
|
+
var RadioIndicator = styled(RadioGroup2.Indicator, {
|
521
|
+
color: "$white",
|
522
|
+
'&[data-state="checked"]': {
|
523
|
+
animation: `${slideIn2} 200ms ease-out`
|
524
|
+
},
|
525
|
+
'&[data-state="unchecked"]': {
|
526
|
+
animation: `${slideOut2} 200ms ease-out`
|
527
|
+
},
|
528
|
+
variants: {
|
529
|
+
size: {
|
530
|
+
lg: {
|
531
|
+
width: "$5",
|
532
|
+
height: "$5"
|
533
|
+
},
|
534
|
+
md: {
|
535
|
+
width: "$4",
|
536
|
+
height: "$4"
|
537
|
+
},
|
538
|
+
sm: {
|
539
|
+
width: "$3",
|
540
|
+
height: "$3"
|
541
|
+
}
|
542
|
+
}
|
543
|
+
},
|
544
|
+
defaultVariants: {
|
545
|
+
size: "lg"
|
546
|
+
}
|
547
|
+
});
|
548
|
+
var Label2 = styled("label", {
|
549
|
+
fontFamily: "$app",
|
550
|
+
lineHeight: 0,
|
551
|
+
color: "$white",
|
552
|
+
fontWeight: "$regular",
|
553
|
+
cursor: "pointer",
|
554
|
+
variants: {
|
555
|
+
size: {
|
556
|
+
lg: {
|
557
|
+
fontSize: "$xl"
|
558
|
+
},
|
559
|
+
md: {
|
560
|
+
fontSize: "$lg"
|
561
|
+
},
|
562
|
+
sm: {
|
563
|
+
fontSize: "$md"
|
564
|
+
}
|
565
|
+
}
|
566
|
+
},
|
567
|
+
defaultVariants: {
|
568
|
+
size: "lg"
|
569
|
+
}
|
570
|
+
});
|
571
|
+
|
572
|
+
// src/components/Radio/RadioItem/index.tsx
|
573
|
+
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
574
|
+
function RadioItem(_a) {
|
575
|
+
var _b = _a, {
|
576
|
+
label,
|
577
|
+
id,
|
578
|
+
size
|
579
|
+
} = _b, props = __objRest(_b, [
|
580
|
+
"label",
|
581
|
+
"id",
|
582
|
+
"size"
|
583
|
+
]);
|
584
|
+
return /* @__PURE__ */ jsxs2(RadioItemContainer, { children: [
|
585
|
+
/* @__PURE__ */ jsx5(RadioItemUI, __spreadProps(__spreadValues({ id }, props), { size, children: /* @__PURE__ */ jsx5(RadioIndicator, { asChild: true, size, children: /* @__PURE__ */ jsx5(Check2, { weight: "bold" }) }) })),
|
586
|
+
/* @__PURE__ */ jsx5(Label2, { htmlFor: id, size, children: label })
|
587
|
+
] }, id);
|
588
|
+
}
|
589
|
+
|
590
|
+
// src/components/Radio/index.tsx
|
591
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
592
|
+
function Radio(_a) {
|
593
|
+
var _b = _a, { items, size } = _b, props = __objRest(_b, ["items", "size"]);
|
594
|
+
return /* @__PURE__ */ jsx6(RadioUI, __spreadProps(__spreadValues({}, props), { children: items.map((item) => {
|
595
|
+
return /* @__PURE__ */ jsx6(
|
596
|
+
RadioItem,
|
597
|
+
{
|
598
|
+
id: item.id,
|
599
|
+
label: item.label,
|
600
|
+
value: item.value,
|
601
|
+
size
|
602
|
+
}
|
603
|
+
);
|
604
|
+
}) }));
|
605
|
+
}
|
606
|
+
|
607
|
+
// src/components/Text/styles.ts
|
608
|
+
var TextUI = styled("p", {
|
609
|
+
fontFamily: "$web",
|
610
|
+
lineHeight: "$base",
|
611
|
+
margin: 0,
|
612
|
+
color: "$white",
|
613
|
+
variants: {
|
614
|
+
size: {
|
615
|
+
xxs: { fontSize: "$xxs" },
|
616
|
+
xs: { fontSize: "$xs" },
|
617
|
+
sm: { fontSize: "$sm" },
|
618
|
+
md: { fontSize: "$md" },
|
619
|
+
lg: { fontSize: "$lg" },
|
620
|
+
xl: { fontSize: "$xl" },
|
621
|
+
"2xl": { fontSize: "$2xl" }
|
622
|
+
}
|
623
|
+
},
|
624
|
+
defaultVariants: {
|
625
|
+
size: "md"
|
626
|
+
}
|
627
|
+
});
|
628
|
+
|
629
|
+
// src/components/Text/index.tsx
|
630
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
631
|
+
function Text(_a) {
|
632
|
+
var _b = _a, {
|
633
|
+
children,
|
634
|
+
size = "md"
|
635
|
+
} = _b, props = __objRest(_b, [
|
636
|
+
"children",
|
637
|
+
"size"
|
638
|
+
]);
|
639
|
+
return /* @__PURE__ */ jsx7(TextUI, __spreadProps(__spreadValues({ size }, props), { children }));
|
640
|
+
}
|
641
|
+
Text.displayName = "Text";
|
642
|
+
|
643
|
+
// src/components/TextArea/styles.ts
|
644
|
+
var TextAreaUI = styled("textarea", {
|
645
|
+
fontFamily: "$app",
|
646
|
+
fontSize: "$lg",
|
647
|
+
color: "$white",
|
648
|
+
fontWeight: "$regular",
|
649
|
+
resize: "vertical",
|
650
|
+
border: "0.7px solid $gray400",
|
651
|
+
margin: 0,
|
652
|
+
backgroundColor: "transparent",
|
653
|
+
borderBottom: "2px solid $dafaz600",
|
654
|
+
borderRadius: "$md",
|
655
|
+
boxSizing: "border-box",
|
656
|
+
display: "flex",
|
657
|
+
alignItems: "baseline",
|
658
|
+
width: "100%",
|
659
|
+
padding: "$1 $2",
|
660
|
+
"&:focus": {
|
661
|
+
outline: 0
|
662
|
+
},
|
663
|
+
"&:disabled": {
|
664
|
+
opacity: 0.5,
|
665
|
+
cursor: "not-allowed"
|
666
|
+
},
|
667
|
+
"&::placeholder": {
|
668
|
+
fontSize: "$xl",
|
669
|
+
fontWeight: "$regular",
|
670
|
+
color: "$white",
|
671
|
+
opacity: 0.75
|
672
|
+
}
|
673
|
+
});
|
674
|
+
|
675
|
+
// src/components/TextArea/index.tsx
|
676
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
677
|
+
function TextArea(_a) {
|
678
|
+
var _b = _a, {
|
679
|
+
children
|
680
|
+
} = _b, props = __objRest(_b, [
|
681
|
+
"children"
|
682
|
+
]);
|
683
|
+
return /* @__PURE__ */ jsx8(TextAreaUI, __spreadProps(__spreadValues({ rows: 3 }, props), { children }));
|
684
|
+
}
|
685
|
+
TextArea.displayName = "TextArea";
|
686
|
+
|
344
687
|
// src/components/TextInput/index.tsx
|
345
688
|
import {
|
346
689
|
forwardRef,
|
@@ -409,7 +752,7 @@ var Sufix = styled("span", {
|
|
409
752
|
});
|
410
753
|
|
411
754
|
// src/components/TextInput/index.tsx
|
412
|
-
import { jsx as
|
755
|
+
import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
|
413
756
|
var TextInput = forwardRef(
|
414
757
|
(_a, ref) => {
|
415
758
|
var _b = _a, {
|
@@ -431,18 +774,21 @@ var TextInput = forwardRef(
|
|
431
774
|
}
|
432
775
|
}
|
433
776
|
}
|
434
|
-
return /* @__PURE__ */
|
435
|
-
/* @__PURE__ */
|
436
|
-
!hiddenOptional && /* @__PURE__ */
|
777
|
+
return /* @__PURE__ */ jsxs3(InputContainer, { withShadow, children: [
|
778
|
+
/* @__PURE__ */ jsx9(InputUI, __spreadValues({ ref, onChange: handleOnChange }, props)),
|
779
|
+
!hiddenOptional && /* @__PURE__ */ jsx9(Sufix, { style: { marginLeft: `-${requiredText.length / 2}rem` }, children: requiredText })
|
437
780
|
] });
|
438
781
|
}
|
439
782
|
);
|
440
|
-
TextInput.displayName = "
|
783
|
+
TextInput.displayName = "TextInput";
|
441
784
|
export {
|
442
785
|
Box,
|
443
786
|
Button,
|
787
|
+
CheckBox,
|
444
788
|
Heading,
|
789
|
+
Radio,
|
445
790
|
Text,
|
791
|
+
TextArea,
|
446
792
|
TextInput,
|
447
793
|
config,
|
448
794
|
createTheme,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dafaz-ui/react",
|
3
|
-
"version": "
|
3
|
+
"version": "3.0.0",
|
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
|
+
}
|