@adamosuiteservices/ui 2.14.2 → 2.15.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/dist/combobox-DGuQtXjP.js +608 -0
- package/dist/combobox-hTCtPMUL.cjs +40 -0
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.js +1 -1
- package/dist/components/ui/combobox/combobox.d.ts +5 -1
- package/dist/components/ui/date-picker-selector/date-picker-selector.d.ts +5 -1
- package/dist/components/ui/file-upload/file-upload.d.ts +4 -1
- package/dist/components/ui/slider/slider.d.ts +1 -1
- package/dist/components/ui/switch/switch.d.ts +1 -1
- package/dist/date-picker-selector.cjs +1 -1
- package/dist/date-picker-selector.js +38 -28
- package/dist/field.cjs +2 -2
- package/dist/field.js +2 -2
- package/dist/file-upload.cjs +5 -3
- package/dist/file-upload.js +191 -150
- package/dist/slider.cjs +5 -5
- package/dist/slider.js +196 -177
- package/dist/styles.css +1 -1
- package/dist/switch.cjs +3 -3
- package/dist/switch.js +105 -85
- package/docs/components/ui/accordion-rounded.md +2 -6
- package/docs/components/ui/avatar.md +3 -1
- package/docs/components/ui/button.md +22 -16
- package/docs/components/ui/card.md +49 -31
- package/docs/components/ui/checkbox.md +44 -8
- package/docs/components/ui/combobox.md +62 -4
- package/docs/components/ui/date-picker-selector.md +90 -26
- package/docs/components/ui/file-upload.md +364 -95
- package/docs/components/ui/icon.md +1 -1
- package/docs/components/ui/input.md +4 -1
- package/docs/components/ui/radio-group.md +1 -1
- package/docs/components/ui/select.md +51 -34
- package/docs/components/ui/sheet.md +3 -9
- package/docs/components/ui/slider.md +120 -99
- package/docs/components/ui/switch.md +408 -408
- package/docs/components/ui/textarea.md +37 -22
- package/docs/components/ui/tooltip.md +5 -2
- package/docs/components/ui/typography.md +63 -39
- package/package.json +1 -1
- package/dist/combobox-CCJGIMFQ.cjs +0 -40
- package/dist/combobox-Cj-GEp-T.js +0 -604
package/dist/switch.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./jsx-runtime-BB_1_6y_.cjs"),T=require("react"),S=require("./index-BWaO7kQK.cjs"),j=require("./index-_XxjJPRD.cjs"),M=require("./index-cwZN7ZY3.cjs"),B=require("./index-DYxWvftI.cjs"),D=require("./index-bSPhqlcX.cjs"),y=require("./index-CocSS1YK.cjs"),R=require("./index-DoxiiusW.cjs");function I(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,s.get?s:{enumerable:!0,get:()=>t[e]})}}return r.default=t,Object.freeze(r)}const a=I(T);var x="Switch",[$]=M.createContextScope(x),[F,z]=$(x),C=a.forwardRef((t,r)=>{const{__scopeSwitch:e,name:s,checked:n,defaultChecked:o,required:u,disabled:i,value:c="on",onCheckedChange:d,form:m,...v}=t,[p,f]=a.useState(null),w=j.useComposedRefs(r,h=>f(h)),g=a.useRef(!1),k=p?m||!!p.closest("form"):!0,[b,N]=S.useControllableState({prop:n,defaultProp:o??!1,onChange:d,caller:x});return l.jsxRuntimeExports.jsxs(F,{scope:e,checked:b,disabled:i,children:[l.jsxRuntimeExports.jsx(y.Primitive.button,{type:"button",role:"switch","aria-checked":b,"aria-required":u,"data-state":q(b),"data-disabled":i?"":void 0,disabled:i,value:c,...v,ref:w,onClick:S.composeEventHandlers(t.onClick,h=>{N(O=>!O),k&&(g.current=h.isPropagationStopped(),g.current||h.stopPropagation())})}),k&&l.jsxRuntimeExports.jsx(_,{control:p,bubbles:!g.current,name:s,value:c,checked:b,required:u,disabled:i,form:m,style:{transform:"translateX(-100%)"}})]})});C.displayName=x;var E="SwitchThumb",P=a.forwardRef((t,r)=>{const{__scopeSwitch:e,...s}=t,n=z(E,e);return l.jsxRuntimeExports.jsx(y.Primitive.span,{"data-state":q(n.checked),"data-disabled":n.disabled?"":void 0,...s,ref:r})});P.displayName=E;var H="SwitchBubbleInput",_=a.forwardRef(({__scopeSwitch:t,control:r,checked:e,bubbles:s=!0,...n},o)=>{const u=a.useRef(null),i=j.useComposedRefs(u,o),c=B.usePrevious(e),d=D.useSize(r);return a.useEffect(()=>{const m=u.current;if(!m)return;const v=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(v,"checked").set;if(c!==e&&f){const w=new Event("click",{bubbles:s});f.call(m,e),m.dispatchEvent(w)}},[c,e,s]),l.jsxRuntimeExports.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:e,...n,tabIndex:-1,ref:i,style:{...n.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});_.displayName=H;function q(t){return t?"checked":"unchecked"}var A=C,U=P;function L({className:t,disabled:r,...e}){const[s,n]=a.useState(!1),o=a.useRef(null);a.useEffect(()=>{const i=()=>{if(o.current){const d=o.current.closest("fieldset");n(d?.disabled??!1)}};i();const c=new MutationObserver(i);if(o.current){const d=o.current.closest("fieldset");d&&c.observe(d,{attributes:!0,attributeFilter:["disabled"]})}return()=>c.disconnect()},[]);const u=r||s;return l.jsxRuntimeExports.jsx(A,{ref:o,"data-slot":"switch",disabled:u,className:R.cn(`
|
|
2
2
|
adm:peer adm:inline-flex adm:h-5 adm:w-8 adm:shrink-0 adm:items-center
|
|
3
3
|
adm:rounded-full adm:border adm:border-transparent adm:shadow-xs
|
|
4
4
|
adm:transition-all adm:outline-none
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
adm:data-[state=checked]:bg-primary
|
|
9
9
|
adm:data-[state=unchecked]:bg-input
|
|
10
10
|
adm:dark:data-[state=unchecked]:bg-input/80
|
|
11
|
-
`,
|
|
11
|
+
`,t),...e,children:l.jsxRuntimeExports.jsx(U,{"data-slot":"switch-thumb",className:R.cn(`
|
|
12
12
|
adm:pointer-events-none adm:block adm:size-4 adm:rounded-full
|
|
13
13
|
adm:bg-background adm:ring-0 adm:transition-transform
|
|
14
14
|
adm:data-[state=checked]:translate-x-[calc(100%-2px)]
|
|
15
15
|
adm:data-[state=unchecked]:translate-x-0
|
|
16
16
|
adm:dark:data-[state=checked]:bg-primary-foreground
|
|
17
17
|
adm:dark:data-[state=unchecked]:bg-foreground
|
|
18
|
-
`)})})}exports.Switch=
|
|
18
|
+
`)})})}exports.Switch=L;
|
package/dist/switch.js
CHANGED
|
@@ -1,116 +1,116 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { j as
|
|
3
|
-
import * as
|
|
4
|
-
import { u as
|
|
2
|
+
import { j as l } from "./jsx-runtime-BzflLqGi.js";
|
|
3
|
+
import * as t from "react";
|
|
4
|
+
import { u as I, c as T } from "./index-C0UREtMP.js";
|
|
5
5
|
import { u as C } from "./index-DLcqcWxM.js";
|
|
6
6
|
import { c as M } from "./index-FxyLF8MY.js";
|
|
7
|
-
import { u as
|
|
8
|
-
import { u as
|
|
7
|
+
import { u as D } from "./index-BZPx6jYI.js";
|
|
8
|
+
import { u as F } from "./index-BGQepRFJ.js";
|
|
9
9
|
import { P as y } from "./index-BMWt1NBG.js";
|
|
10
|
-
import { c as
|
|
11
|
-
var
|
|
12
|
-
(
|
|
10
|
+
import { c as x } from "./index-CRiPKpXj.js";
|
|
11
|
+
var k = "Switch", [H] = M(k), [z, A] = H(k), P = t.forwardRef(
|
|
12
|
+
(a, i) => {
|
|
13
13
|
const {
|
|
14
|
-
__scopeSwitch:
|
|
14
|
+
__scopeSwitch: e,
|
|
15
15
|
name: n,
|
|
16
|
-
checked:
|
|
17
|
-
defaultChecked:
|
|
18
|
-
required:
|
|
19
|
-
disabled:
|
|
20
|
-
value:
|
|
21
|
-
onCheckedChange:
|
|
22
|
-
form:
|
|
23
|
-
...
|
|
24
|
-
} =
|
|
25
|
-
prop:
|
|
26
|
-
defaultProp:
|
|
27
|
-
onChange:
|
|
28
|
-
caller:
|
|
16
|
+
checked: s,
|
|
17
|
+
defaultChecked: r,
|
|
18
|
+
required: u,
|
|
19
|
+
disabled: o,
|
|
20
|
+
value: c = "on",
|
|
21
|
+
onCheckedChange: d,
|
|
22
|
+
form: m,
|
|
23
|
+
...v
|
|
24
|
+
} = a, [f, p] = t.useState(null), w = C(i, (b) => p(b)), S = t.useRef(!1), g = f ? m || !!f.closest("form") : !0, [h, N] = I({
|
|
25
|
+
prop: s,
|
|
26
|
+
defaultProp: r ?? !1,
|
|
27
|
+
onChange: d,
|
|
28
|
+
caller: k
|
|
29
29
|
});
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
-
/* @__PURE__ */
|
|
30
|
+
return /* @__PURE__ */ l.jsxs(z, { scope: e, checked: h, disabled: o, children: [
|
|
31
|
+
/* @__PURE__ */ l.jsx(
|
|
32
32
|
y.button,
|
|
33
33
|
{
|
|
34
34
|
type: "button",
|
|
35
35
|
role: "switch",
|
|
36
|
-
"aria-checked":
|
|
37
|
-
"aria-required":
|
|
38
|
-
"data-state": _(
|
|
39
|
-
"data-disabled":
|
|
40
|
-
disabled:
|
|
41
|
-
value:
|
|
42
|
-
...
|
|
43
|
-
ref:
|
|
44
|
-
onClick:
|
|
45
|
-
N((B) => !B),
|
|
36
|
+
"aria-checked": h,
|
|
37
|
+
"aria-required": u,
|
|
38
|
+
"data-state": _(h),
|
|
39
|
+
"data-disabled": o ? "" : void 0,
|
|
40
|
+
disabled: o,
|
|
41
|
+
value: c,
|
|
42
|
+
...v,
|
|
43
|
+
ref: w,
|
|
44
|
+
onClick: T(a.onClick, (b) => {
|
|
45
|
+
N((B) => !B), g && (S.current = b.isPropagationStopped(), S.current || b.stopPropagation());
|
|
46
46
|
})
|
|
47
47
|
}
|
|
48
48
|
),
|
|
49
|
-
|
|
49
|
+
g && /* @__PURE__ */ l.jsx(
|
|
50
50
|
j,
|
|
51
51
|
{
|
|
52
|
-
control:
|
|
53
|
-
bubbles: !
|
|
52
|
+
control: f,
|
|
53
|
+
bubbles: !S.current,
|
|
54
54
|
name: n,
|
|
55
|
-
value:
|
|
56
|
-
checked:
|
|
57
|
-
required:
|
|
58
|
-
disabled:
|
|
59
|
-
form:
|
|
55
|
+
value: c,
|
|
56
|
+
checked: h,
|
|
57
|
+
required: u,
|
|
58
|
+
disabled: o,
|
|
59
|
+
form: m,
|
|
60
60
|
style: { transform: "translateX(-100%)" }
|
|
61
61
|
}
|
|
62
62
|
)
|
|
63
63
|
] });
|
|
64
64
|
}
|
|
65
65
|
);
|
|
66
|
-
P.displayName =
|
|
67
|
-
var R = "SwitchThumb", E =
|
|
68
|
-
(
|
|
69
|
-
const { __scopeSwitch:
|
|
70
|
-
return /* @__PURE__ */
|
|
66
|
+
P.displayName = k;
|
|
67
|
+
var R = "SwitchThumb", E = t.forwardRef(
|
|
68
|
+
(a, i) => {
|
|
69
|
+
const { __scopeSwitch: e, ...n } = a, s = A(R, e);
|
|
70
|
+
return /* @__PURE__ */ l.jsx(
|
|
71
71
|
y.span,
|
|
72
72
|
{
|
|
73
|
-
"data-state": _(
|
|
74
|
-
"data-disabled":
|
|
73
|
+
"data-state": _(s.checked),
|
|
74
|
+
"data-disabled": s.disabled ? "" : void 0,
|
|
75
75
|
...n,
|
|
76
|
-
ref:
|
|
76
|
+
ref: i
|
|
77
77
|
}
|
|
78
78
|
);
|
|
79
79
|
}
|
|
80
80
|
);
|
|
81
81
|
E.displayName = R;
|
|
82
|
-
var
|
|
82
|
+
var O = "SwitchBubbleInput", j = t.forwardRef(
|
|
83
83
|
({
|
|
84
|
-
__scopeSwitch:
|
|
85
|
-
control:
|
|
86
|
-
checked:
|
|
84
|
+
__scopeSwitch: a,
|
|
85
|
+
control: i,
|
|
86
|
+
checked: e,
|
|
87
87
|
bubbles: n = !0,
|
|
88
|
-
...
|
|
89
|
-
},
|
|
90
|
-
const
|
|
91
|
-
return
|
|
92
|
-
const
|
|
93
|
-
if (!
|
|
94
|
-
const
|
|
95
|
-
|
|
88
|
+
...s
|
|
89
|
+
}, r) => {
|
|
90
|
+
const u = t.useRef(null), o = C(u, r), c = D(e), d = F(i);
|
|
91
|
+
return t.useEffect(() => {
|
|
92
|
+
const m = u.current;
|
|
93
|
+
if (!m) return;
|
|
94
|
+
const v = window.HTMLInputElement.prototype, p = Object.getOwnPropertyDescriptor(
|
|
95
|
+
v,
|
|
96
96
|
"checked"
|
|
97
97
|
).set;
|
|
98
|
-
if (
|
|
99
|
-
const
|
|
100
|
-
|
|
98
|
+
if (c !== e && p) {
|
|
99
|
+
const w = new Event("click", { bubbles: n });
|
|
100
|
+
p.call(m, e), m.dispatchEvent(w);
|
|
101
101
|
}
|
|
102
|
-
}, [
|
|
102
|
+
}, [c, e, n]), /* @__PURE__ */ l.jsx(
|
|
103
103
|
"input",
|
|
104
104
|
{
|
|
105
105
|
type: "checkbox",
|
|
106
106
|
"aria-hidden": !0,
|
|
107
|
-
defaultChecked:
|
|
108
|
-
...
|
|
107
|
+
defaultChecked: e,
|
|
108
|
+
...s,
|
|
109
109
|
tabIndex: -1,
|
|
110
|
-
ref:
|
|
110
|
+
ref: o,
|
|
111
111
|
style: {
|
|
112
|
-
...
|
|
113
|
-
...
|
|
112
|
+
...s.style,
|
|
113
|
+
...d,
|
|
114
114
|
position: "absolute",
|
|
115
115
|
pointerEvents: "none",
|
|
116
116
|
opacity: 0,
|
|
@@ -120,20 +120,40 @@ var L = "SwitchBubbleInput", j = s.forwardRef(
|
|
|
120
120
|
);
|
|
121
121
|
}
|
|
122
122
|
);
|
|
123
|
-
j.displayName =
|
|
124
|
-
function _(
|
|
125
|
-
return
|
|
123
|
+
j.displayName = O;
|
|
124
|
+
function _(a) {
|
|
125
|
+
return a ? "checked" : "unchecked";
|
|
126
126
|
}
|
|
127
|
-
var
|
|
127
|
+
var U = P, q = E;
|
|
128
128
|
function V({
|
|
129
|
-
className:
|
|
130
|
-
|
|
129
|
+
className: a,
|
|
130
|
+
disabled: i,
|
|
131
|
+
...e
|
|
131
132
|
}) {
|
|
132
|
-
|
|
133
|
-
|
|
133
|
+
const [n, s] = t.useState(!1), r = t.useRef(null);
|
|
134
|
+
t.useEffect(() => {
|
|
135
|
+
const o = () => {
|
|
136
|
+
if (r.current) {
|
|
137
|
+
const d = r.current.closest("fieldset");
|
|
138
|
+
s(d?.disabled ?? !1);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
o();
|
|
142
|
+
const c = new MutationObserver(o);
|
|
143
|
+
if (r.current) {
|
|
144
|
+
const d = r.current.closest("fieldset");
|
|
145
|
+
d && c.observe(d, { attributes: !0, attributeFilter: ["disabled"] });
|
|
146
|
+
}
|
|
147
|
+
return () => c.disconnect();
|
|
148
|
+
}, []);
|
|
149
|
+
const u = i || n;
|
|
150
|
+
return /* @__PURE__ */ l.jsx(
|
|
151
|
+
U,
|
|
134
152
|
{
|
|
153
|
+
ref: r,
|
|
135
154
|
"data-slot": "switch",
|
|
136
|
-
|
|
155
|
+
disabled: u,
|
|
156
|
+
className: x(
|
|
137
157
|
`
|
|
138
158
|
adm:peer adm:inline-flex adm:h-5 adm:w-8 adm:shrink-0 adm:items-center
|
|
139
159
|
adm:rounded-full adm:border adm:border-transparent adm:shadow-xs
|
|
@@ -145,14 +165,14 @@ function V({
|
|
|
145
165
|
adm:data-[state=unchecked]:bg-input
|
|
146
166
|
adm:dark:data-[state=unchecked]:bg-input/80
|
|
147
167
|
`,
|
|
148
|
-
|
|
168
|
+
a
|
|
149
169
|
),
|
|
150
|
-
...
|
|
151
|
-
children: /* @__PURE__ */
|
|
152
|
-
|
|
170
|
+
...e,
|
|
171
|
+
children: /* @__PURE__ */ l.jsx(
|
|
172
|
+
q,
|
|
153
173
|
{
|
|
154
174
|
"data-slot": "switch-thumb",
|
|
155
|
-
className:
|
|
175
|
+
className: x(
|
|
156
176
|
`
|
|
157
177
|
adm:pointer-events-none adm:block adm:size-4 adm:rounded-full
|
|
158
178
|
adm:bg-background adm:ring-0 adm:transition-transform
|
|
@@ -325,9 +325,7 @@ Varios items pueden estar abiertos simultáneamente:
|
|
|
325
325
|
/>
|
|
326
326
|
<AccordionContent>
|
|
327
327
|
<div className="p-4">
|
|
328
|
-
<p className="text-sm text-foreground">
|
|
329
|
-
Manage notification settings.
|
|
330
|
-
</p>
|
|
328
|
+
<p className="text-sm text-foreground">Manage notification settings.</p>
|
|
331
329
|
</div>
|
|
332
330
|
</AccordionContent>
|
|
333
331
|
</AccordionItem>
|
|
@@ -376,9 +374,7 @@ Varios items pueden estar abiertos simultáneamente:
|
|
|
376
374
|
<div className="p-4 space-y-4">
|
|
377
375
|
<div className="flex items-center justify-between p-3 bg-muted rounded-lg">
|
|
378
376
|
<div>
|
|
379
|
-
<p className="text-sm font-semibold text-foreground">
|
|
380
|
-
Credit Card
|
|
381
|
-
</p>
|
|
377
|
+
<p className="text-sm font-semibold text-foreground">Credit Card</p>
|
|
382
378
|
<p className="text-xs text-muted-foreground">•••• 4242</p>
|
|
383
379
|
</div>
|
|
384
380
|
<span className="text-xs text-success font-medium">Active</span>
|
|
@@ -525,7 +525,9 @@ Mantén tamaños consistentes por contexto:
|
|
|
525
525
|
```tsx
|
|
526
526
|
<Avatar>
|
|
527
527
|
<AvatarImage src={url} alt="User" />
|
|
528
|
-
<AvatarFallback className="bg-primary text-primary-foreground">
|
|
528
|
+
<AvatarFallback className="bg-primary text-primary-foreground">
|
|
529
|
+
AB
|
|
530
|
+
</AvatarFallback>
|
|
529
531
|
</Avatar>
|
|
530
532
|
```
|
|
531
533
|
|
|
@@ -446,7 +446,9 @@ Anillo visible solo al navegar con teclado.
|
|
|
446
446
|
Para formularios con validación. **Nota**: Solo funciona con la variante `outline` que tiene borde visible.
|
|
447
447
|
|
|
448
448
|
```tsx
|
|
449
|
-
<Button variant="outline" aria-invalid="true">
|
|
449
|
+
<Button variant="outline" aria-invalid="true">
|
|
450
|
+
Invalid Button
|
|
451
|
+
</Button>
|
|
450
452
|
```
|
|
451
453
|
|
|
452
454
|
**Estilos aplicados** (solo en variante outline):
|
|
@@ -619,18 +621,18 @@ import { Icon } from "@adamosuiteservices/ui/icon";
|
|
|
619
621
|
|
|
620
622
|
## Props
|
|
621
623
|
|
|
622
|
-
| Prop | Tipo
|
|
623
|
-
| --------- |
|
|
624
|
+
| Prop | Tipo | Default | Descripción |
|
|
625
|
+
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------- | -------------------------------------------------------------- |
|
|
624
626
|
| variant | `"default" \| "success" \| "success-medium" \| "warning" \| "warning-medium" \| "destructive" \| "destructive-medium" \| "secondary" \| "outline" \| "ghost" \| "ghost-neutral" \| "link"` | `"default"` | Variante visual del botón |
|
|
625
|
-
| size | `"default" \| "sm" \| "lg" \| "icon" \| "icon-sm" \| "icon-lg"`
|
|
626
|
-
| asChild | `boolean`
|
|
627
|
-
| loading | `boolean`
|
|
628
|
-
| disabled | `boolean`
|
|
629
|
-
| className | `string`
|
|
630
|
-
| children | `ReactNode`
|
|
631
|
-
| type | `"button" \| "submit" \| "reset"`
|
|
632
|
-
| onClick | `(e: MouseEvent) => void`
|
|
633
|
-
| ...props | `ButtonHTMLAttributes`
|
|
627
|
+
| size | `"default" \| "sm" \| "lg" \| "icon" \| "icon-sm" \| "icon-lg"` | `"default"` | Tamaño del botón |
|
|
628
|
+
| asChild | `boolean` | `false` | Renderiza el hijo en lugar de un `<button>`. Usa Radix UI Slot |
|
|
629
|
+
| loading | `boolean` | `false` | Muestra spinner automático y desactiva el botón |
|
|
630
|
+
| disabled | `boolean` | `false` | Desactiva el botón (opacity 50%, pointer-events none) |
|
|
631
|
+
| className | `string` | - | Clases CSS adicionales |
|
|
632
|
+
| children | `ReactNode` | - | Contenido del botón (texto, iconos, etc.) |
|
|
633
|
+
| type | `"button" \| "submit" \| "reset"` | `"button"` | Tipo de botón HTML |
|
|
634
|
+
| onClick | `(e: MouseEvent) => void` | - | Handler de click |
|
|
635
|
+
| ...props | `ButtonHTMLAttributes` | - | Todas las props nativas de `<button>` |
|
|
634
636
|
|
|
635
637
|
**Nota sobre asChild**: Cuando es `true`, el componente usa `Slot` de Radix UI para transferir todas las props y estilos al hijo directo.
|
|
636
638
|
|
|
@@ -779,7 +781,9 @@ Acciones en footer de dialogs.
|
|
|
779
781
|
Botones de herramientas con iconos.
|
|
780
782
|
|
|
781
783
|
```tsx
|
|
782
|
-
{
|
|
784
|
+
{
|
|
785
|
+
/* Toolbar con ghost para acciones primarias */
|
|
786
|
+
}
|
|
783
787
|
<div className="flex gap-1 p-2 border rounded-lg">
|
|
784
788
|
<Button size="icon-sm" variant="ghost" aria-label="Bold">
|
|
785
789
|
<BoldIcon />
|
|
@@ -797,9 +801,11 @@ Botones de herramientas con iconos.
|
|
|
797
801
|
<Button size="icon-sm" variant="ghost" aria-label="Align center">
|
|
798
802
|
<AlignCenterIcon />
|
|
799
803
|
</Button>
|
|
800
|
-
</div
|
|
804
|
+
</div>;
|
|
801
805
|
|
|
802
|
-
{
|
|
806
|
+
{
|
|
807
|
+
/* Toolbar con ghost-neutral para apariencia más sutil */
|
|
808
|
+
}
|
|
803
809
|
<div className="flex gap-1 p-2 border rounded-lg">
|
|
804
810
|
<Button size="icon-sm" variant="ghost-neutral" aria-label="Bold">
|
|
805
811
|
<BoldIcon />
|
|
@@ -810,7 +816,7 @@ Botones de herramientas con iconos.
|
|
|
810
816
|
<Button size="icon-sm" variant="ghost-neutral" aria-label="Underline">
|
|
811
817
|
<UnderlineIcon />
|
|
812
818
|
</Button>
|
|
813
|
-
</div
|
|
819
|
+
</div>;
|
|
814
820
|
```
|
|
815
821
|
|
|
816
822
|
### Call to Action (CTA)
|
|
@@ -106,13 +106,13 @@ Contenedor principal de la card.
|
|
|
106
106
|
|
|
107
107
|
#### Props
|
|
108
108
|
|
|
109
|
-
| Prop | Tipo | Default | Descripción
|
|
110
|
-
| ----------- | ------------------------------------------------------------------------------ | ----------- |
|
|
111
|
-
| `variant` | `"default" \| "primary" \| "muted" \| "success" \| "warning" \| "destructive"` | `"default"` | Variante de color de fondo
|
|
112
|
-
| `shadow` | `"default" \| "none"` | `"none"` | Control de sombra (none=flat, default=elevación)
|
|
113
|
-
| `border` | `"default" \| "transparent"` | `"default"` | Control de borde (default=visible, transparent=invisible)
|
|
114
|
-
| `className` | `string` | - | Clases CSS adicionales
|
|
115
|
-
| `children` | `ReactNode` | - | Contenido de la card
|
|
109
|
+
| Prop | Tipo | Default | Descripción |
|
|
110
|
+
| ----------- | ------------------------------------------------------------------------------ | ----------- | --------------------------------------------------------- |
|
|
111
|
+
| `variant` | `"default" \| "primary" \| "muted" \| "success" \| "warning" \| "destructive"` | `"default"` | Variante de color de fondo |
|
|
112
|
+
| `shadow` | `"default" \| "none"` | `"none"` | Control de sombra (none=flat, default=elevación) |
|
|
113
|
+
| `border` | `"default" \| "transparent"` | `"default"` | Control de borde (default=visible, transparent=invisible) |
|
|
114
|
+
| `className` | `string` | - | Clases CSS adicionales |
|
|
115
|
+
| `children` | `ReactNode` | - | Contenido de la card |
|
|
116
116
|
|
|
117
117
|
### CardHeader
|
|
118
118
|
|
|
@@ -388,7 +388,9 @@ Card con sombra sutil para crear profundidad cuando se necesita énfasis.
|
|
|
388
388
|
La prop `shadow` funciona con todas las variantes de color.
|
|
389
389
|
|
|
390
390
|
```tsx
|
|
391
|
-
{
|
|
391
|
+
{
|
|
392
|
+
/* Flat colored cards */
|
|
393
|
+
}
|
|
392
394
|
<Card variant="primary" shadow="none" className="w-[350px]">
|
|
393
395
|
<CardHeader>
|
|
394
396
|
<CardTitle>Flat Primary</CardTitle>
|
|
@@ -399,9 +401,11 @@ La prop `shadow` funciona con todas las variantes de color.
|
|
|
399
401
|
Combines color variant with flat design for modern appearance.
|
|
400
402
|
</p>
|
|
401
403
|
</CardContent>
|
|
402
|
-
</Card
|
|
404
|
+
</Card>;
|
|
403
405
|
|
|
404
|
-
{
|
|
406
|
+
{
|
|
407
|
+
/* Elevated colored cards */
|
|
408
|
+
}
|
|
405
409
|
<Card variant="success" shadow="default" className="w-[350px]">
|
|
406
410
|
<CardHeader>
|
|
407
411
|
<CardTitle>Elevated Success</CardTitle>
|
|
@@ -412,7 +416,7 @@ La prop `shadow` funciona con todas las variantes de color.
|
|
|
412
416
|
Shadow adds depth to colored variants for emphasis.
|
|
413
417
|
</p>
|
|
414
418
|
</CardContent>
|
|
415
|
-
</Card
|
|
419
|
+
</Card>;
|
|
416
420
|
```
|
|
417
421
|
|
|
418
422
|
**Nota**: Experimenta con `shadow="none"` en grids de cards o layouts densos para un look más limpio.
|
|
@@ -1017,25 +1021,33 @@ Diferentes arreglos de botones.
|
|
|
1017
1021
|
### Uso de Sombras y Bordes
|
|
1018
1022
|
|
|
1019
1023
|
```tsx
|
|
1020
|
-
{
|
|
1024
|
+
{
|
|
1025
|
+
/* ✅ Correcto - Default sin sombra para diseño plano */
|
|
1026
|
+
}
|
|
1021
1027
|
<Card>
|
|
1022
1028
|
<CardContent>Clean, flat design</CardContent>
|
|
1023
|
-
</Card
|
|
1029
|
+
</Card>;
|
|
1024
1030
|
|
|
1025
|
-
{
|
|
1031
|
+
{
|
|
1032
|
+
/* ✅ Correcto - Shadow para cards flotantes o destacadas */
|
|
1033
|
+
}
|
|
1026
1034
|
<Card shadow="default">
|
|
1027
1035
|
<CardContent>Elevated card with depth</CardContent>
|
|
1028
|
-
</Card
|
|
1036
|
+
</Card>;
|
|
1029
1037
|
|
|
1030
|
-
{
|
|
1038
|
+
{
|
|
1039
|
+
/* ✅ Correcto - Border transparent para integración con fondo */
|
|
1040
|
+
}
|
|
1031
1041
|
<Card border="transparent" variant="muted">
|
|
1032
1042
|
<CardContent>Blends with background</CardContent>
|
|
1033
|
-
</Card
|
|
1043
|
+
</Card>;
|
|
1034
1044
|
|
|
1035
|
-
{
|
|
1045
|
+
{
|
|
1046
|
+
/* ⚠️ Evitar - Shadow sin propósito específico */
|
|
1047
|
+
}
|
|
1036
1048
|
<Card shadow="default">
|
|
1037
1049
|
<CardContent>Unnecessary elevation</CardContent>
|
|
1038
|
-
</Card
|
|
1050
|
+
</Card>;
|
|
1039
1051
|
```
|
|
1040
1052
|
|
|
1041
1053
|
**Recomendaciones**:
|
|
@@ -1179,14 +1191,16 @@ Diferentes arreglos de botones.
|
|
|
1179
1191
|
### Uso de Shadow
|
|
1180
1192
|
|
|
1181
1193
|
```tsx
|
|
1182
|
-
{
|
|
1194
|
+
{
|
|
1195
|
+
/* ✅ Correcto - Shadow para cards individuales o destacadas */
|
|
1196
|
+
}
|
|
1183
1197
|
<Card shadow="default" className="w-[350px]">
|
|
1184
|
-
<CardContent>
|
|
1185
|
-
|
|
1186
|
-
</CardContent>
|
|
1187
|
-
</Card>
|
|
1198
|
+
<CardContent>Stands out with subtle elevation</CardContent>
|
|
1199
|
+
</Card>;
|
|
1188
1200
|
|
|
1189
|
-
{
|
|
1201
|
+
{
|
|
1202
|
+
/* ✅ Correcto - Sin shadow para grids densos */
|
|
1203
|
+
}
|
|
1190
1204
|
<div className="grid gap-4 md:grid-cols-3">
|
|
1191
1205
|
<Card shadow="none">
|
|
1192
1206
|
<CardContent>Flat design in dense layout</CardContent>
|
|
@@ -1197,9 +1211,11 @@ Diferentes arreglos de botones.
|
|
|
1197
1211
|
<Card shadow="none">
|
|
1198
1212
|
<CardContent>Flat design in dense layout</CardContent>
|
|
1199
1213
|
</Card>
|
|
1200
|
-
</div
|
|
1214
|
+
</div>;
|
|
1201
1215
|
|
|
1202
|
-
{
|
|
1216
|
+
{
|
|
1217
|
+
/* ✅ Correcto - Sin shadow cuando ya hay separación visual */
|
|
1218
|
+
}
|
|
1203
1219
|
<div className="space-y-4">
|
|
1204
1220
|
<Card shadow="none">
|
|
1205
1221
|
<CardContent>Spacing provides separation</CardContent>
|
|
@@ -1207,15 +1223,17 @@ Diferentes arreglos de botones.
|
|
|
1207
1223
|
<Card shadow="none">
|
|
1208
1224
|
<CardContent>No shadow needed here</CardContent>
|
|
1209
1225
|
</Card>
|
|
1210
|
-
</div
|
|
1226
|
+
</div>;
|
|
1211
1227
|
|
|
1212
|
-
{
|
|
1228
|
+
{
|
|
1229
|
+
/* ⚠️ Considerar - Mucha sombra en layouts densos */
|
|
1230
|
+
}
|
|
1213
1231
|
<div className="grid gap-2 md:grid-cols-4">
|
|
1214
|
-
<Card shadow="default">...</Card>
|
|
1232
|
+
<Card shadow="default">...</Card> {/* Puede verse pesado */}
|
|
1215
1233
|
<Card shadow="default">...</Card>
|
|
1216
1234
|
<Card shadow="default">...</Card>
|
|
1217
1235
|
<Card shadow="default">...</Card>
|
|
1218
|
-
</div
|
|
1236
|
+
</div>;
|
|
1219
1237
|
```
|
|
1220
1238
|
|
|
1221
1239
|
## Notas de Implementación
|
|
@@ -33,7 +33,7 @@ import { Label } from "@adamosuiteservices/ui/label";
|
|
|
33
33
|
| `required` | `boolean` | `false` | Campo requerido (HTML5) |
|
|
34
34
|
| `name` | `string` | - | Nombre para formularios |
|
|
35
35
|
| `value` | `string` | `"on"` | Valor para formularios |
|
|
36
|
-
| `aria-invalid` | `
|
|
36
|
+
| `aria-invalid` | `"true" \| "false"` | - | Muestra estado error (border rojo + ring) |
|
|
37
37
|
| `className` | `string` | - | Clases CSS adicionales |
|
|
38
38
|
|
|
39
39
|
## Estados del Checkbox
|
|
@@ -86,11 +86,38 @@ const someChecked = items.some(Boolean) && !allChecked;
|
|
|
86
86
|
### 5. Invalid (Error State)
|
|
87
87
|
|
|
88
88
|
```tsx
|
|
89
|
-
<Checkbox aria-invalid />
|
|
89
|
+
<Checkbox aria-invalid="true" />
|
|
90
|
+
|
|
91
|
+
// En formularios con validación
|
|
92
|
+
<div className="flex items-start gap-3">
|
|
93
|
+
<Checkbox id="terms" aria-invalid={!agreed} />
|
|
94
|
+
<div className="grid gap-1.5">
|
|
95
|
+
<Label htmlFor="terms">Accept terms and conditions</Label>
|
|
96
|
+
{!agreed && (
|
|
97
|
+
<p className="text-sm text-destructive">
|
|
98
|
+
You must accept the terms to continue
|
|
99
|
+
</p>
|
|
100
|
+
)}
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
90
103
|
```
|
|
91
104
|
|
|
92
105
|
**Estilos**: Border rojo (`border-destructive`) + ring rojo (`ring-destructive/20`)
|
|
93
106
|
|
|
107
|
+
## Fieldset Disabled
|
|
108
|
+
|
|
109
|
+
Los checkboxes dentro de un fieldset deshabilitado automáticamente heredan el estado disabled del navegador:
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
<fieldset disabled>
|
|
113
|
+
<legend>Preferences</legend>
|
|
114
|
+
<div className="flex items-center gap-3">
|
|
115
|
+
<Checkbox id="option1" />
|
|
116
|
+
<Label htmlFor="option1">This will be disabled</Label>
|
|
117
|
+
</div>
|
|
118
|
+
</fieldset>
|
|
119
|
+
```
|
|
120
|
+
|
|
94
121
|
## Patrones de Uso
|
|
95
122
|
|
|
96
123
|
### Con Label Simple
|
|
@@ -223,14 +250,23 @@ const [agreed, setAgreed] = useState(false);
|
|
|
223
250
|
id="terms"
|
|
224
251
|
checked={agreed}
|
|
225
252
|
onCheckedChange={(checked) => setAgreed(checked as boolean)}
|
|
226
|
-
aria-invalid={!agreed}
|
|
253
|
+
aria-invalid={!agreed ? "true" : undefined}
|
|
227
254
|
/>
|
|
228
255
|
<Label htmlFor="terms" className="text-sm">
|
|
229
256
|
I agree to the{" "}
|
|
230
|
-
<a href="/terms" className="underline">
|
|
257
|
+
<a href="/terms" className="underline">
|
|
258
|
+
terms and conditions
|
|
259
|
+
</a>
|
|
231
260
|
</Label>
|
|
232
|
-
</div
|
|
233
|
-
|
|
261
|
+
</div>;
|
|
262
|
+
{
|
|
263
|
+
!agreed && (
|
|
264
|
+
<p className="text-sm text-destructive">
|
|
265
|
+
You must accept the terms to continue
|
|
266
|
+
</p>
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
<Button disabled={!agreed}>Continue</Button>;
|
|
234
270
|
```
|
|
235
271
|
|
|
236
272
|
## Estilos Internos (Data Attributes)
|
|
@@ -288,5 +324,5 @@ const [agreed, setAgreed] = useState(false);
|
|
|
288
324
|
|
|
289
325
|
## Referencias
|
|
290
326
|
|
|
291
|
-
- **Radix UI Checkbox**: https://www.radix-ui.com/primitives/docs/components/checkbox
|
|
292
|
-
- **ARIA Checkbox**: https://www.w3.org/WAI/ARIA/apg/patterns/checkbox
|
|
327
|
+
- **Radix UI Checkbox**: <https://www.radix-ui.com/primitives/docs/components/checkbox>
|
|
328
|
+
- **ARIA Checkbox**: <https://www.w3.org/WAI/ARIA/apg/patterns/checkbox/>
|