@devup-ui/components 0.1.42 → 0.1.44
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/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist/components/Button/IconSpinner.cjs +1 -1
- package/dist/components/Button/IconSpinner.js +72 -84
- package/dist/components/Button/index.cjs +1 -1
- package/dist/components/Button/index.js +220 -217
- package/dist/components/Checkbox/CheckIcon.cjs +1 -1
- package/dist/components/Checkbox/CheckIcon.js +17 -23
- package/dist/components/Checkbox/index.cjs +1 -2
- package/dist/components/Checkbox/index.js +87 -127
- package/dist/components/Input/index.cjs +1 -2
- package/dist/components/Input/index.js +130 -181
- package/dist/components/Radio/index.cjs +1 -1
- package/dist/components/Radio/index.js +143 -194
- package/dist/components/RadioGroup/index.cjs +1 -2
- package/dist/components/RadioGroup/index.js +43 -59
- package/dist/components/Select/IconCheck.cjs +1 -1
- package/dist/components/Select/IconCheck.js +18 -24
- package/dist/components/Select/index.cjs +1 -2
- package/dist/components/Select/index.js +215 -315
- package/dist/components/Stepper/IconMinus.cjs +1 -1
- package/dist/components/Stepper/IconMinus.js +18 -24
- package/dist/components/Stepper/IconPlus.cjs +1 -1
- package/dist/components/Stepper/IconPlus.js +17 -23
- package/dist/components/Stepper/index.cjs +1 -2
- package/dist/components/Stepper/index.js +98 -142
- package/dist/components/Textarea/index.cjs +1 -2
- package/dist/components/Textarea/index.js +85 -108
- package/dist/components/Toggle/index.cjs +1 -2
- package/dist/components/Toggle/index.js +71 -91
- package/dist/contexts/useSelect.cjs +1 -2
- package/dist/contexts/useSelect.js +9 -10
- package/dist/index.cjs +1 -1
- package/dist/index.js +11 -32
- package/package.json +11 -14
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),u=require("@devup-ui/react"),m=require("clsx"),d=require("react"),b=require("../Button/index.cjs"),g=require("../Input/index.cjs"),h=require("./IconMinus.cjs"),I=require("./IconPlus.cjs"),S=d.createContext(null),c=()=>{const e=d.useContext(S);if(!e)throw new Error("useStepper must be used within a StepperProvider");return e};function f({children:e,defaultValue:t,value:r,onValueChange:s,min:n=0,max:i=100,type:a="input"}){const[l,p]=d.useState(t??0),v=F=>{const x=Math.min(Math.max(F,n),i);if(s){s(x);return}p(x)};return o.jsx(S.Provider,{value:{value:r??l,setValue:v,min:n,max:i,type:a},children:e})}function C(e){return o.jsx(u.Flex,{alignItems:"center",gap:"8px",styleOrder:1,...e})}function j({...e}){const{value:t,setValue:r,min:s}=c(),n=t<=s;return o.jsx(b.Button,{"aria-label":"Decrease button",className:u.css({p:"0",boxSize:"28px",borderRadius:"4px"}),disabled:n,onClick:()=>r(t-1),...e,children:o.jsx(h.IconMinus,{className:u.css({color:n?"var(--base10, light-dark(#0000001A,#FFFFFF1A))":"var(--text, light-dark(#272727, #F6F6F6))"})})})}function y({...e}){const{value:t,setValue:r,max:s}=c(),n=t>=s;return o.jsx(b.Button,{"aria-label":"Increase button",className:u.css({p:"0",boxSize:"28px",borderRadius:"4px",selectors:{"&>div>div":{}}}),disabled:n,onClick:()=>r(t+1),...e,children:o.jsx(I.IconPlus,{className:u.css({color:n?"var(--base10, light-dark(#0000001A,#FFFFFF1A))":"var(--text, light-dark(#272727, #F6F6F6))"})})})}function k({className:e,...t}){const{value:r,setValue:s,type:n}=c(),i=u.css({p:"0",border:"none",w:"fit-content",h:"fit-content",styleOrder:3}),a=n==="input",l=a?g.Input:"div";return a&&Object.assign(t,{allowClear:!1}),o.jsx(l,{"aria-label":"Stepper value",className:m(u.css({styleOrder:2,w:"60px",textAlign:"center",borderRadius:"6px",selectors:{"&::-webkit-outer-spin-button, &::-webkit-inner-spin-button":{display:"none"}}}),!a&&i,e),dangerouslySetInnerHTML:a?void 0:{__html:Number(r).toString()},"data-value":r,onChange:p=>{s(Number(p.target.value))},readOnly:!a,type:"number",value:r.toString(),...t})}exports.Stepper=f;exports.StepperContainer=C;exports.StepperDecreaseButton=j;exports.StepperIncreaseButton=y;exports.StepperInput=k;exports.useStepper=c;
|
|
1
|
+
"use client";"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../Button/index.cjs`),n=require(`../Input/index.cjs`),r=require(`./IconMinus.cjs`),i=require(`./IconPlus.cjs`);let a=require(`@devup-ui/react`),o=require(`react/jsx-runtime`),s=require(`react`),c=require(`clsx`);c=e.__toESM(c);var l=(0,s.createContext)(null),u=()=>{let e=(0,s.useContext)(l);if(!e)throw Error(`useStepper must be used within a StepperProvider`);return e};function d({children:e,defaultValue:t,value:n,onValueChange:r,min:i=0,max:a=100,type:c=`input`}){let[u,d]=(0,s.useState)(t??0);return(0,o.jsx)(l.Provider,{value:{value:n??u,setValue:e=>{let t=Math.min(Math.max(e,i),a);if(r){r(t);return}d(t)},min:i,max:a,type:c},children:e})}function f(e){return(0,o.jsx)(a.Flex,{alignItems:`center`,gap:`8px`,styleOrder:1,...e})}function p({...e}){let{value:n,setValue:i,min:s}=u(),c=n<=s;return(0,o.jsx)(t.Button,{"aria-label":`Decrease button`,className:(0,a.css)({p:`0`,boxSize:`28px`,borderRadius:`4px`}),disabled:c,onClick:()=>i(n-1),...e,children:(0,o.jsx)(r.IconMinus,{className:(0,a.css)({color:c?`var(--base10, light-dark(#0000001A,#FFFFFF1A))`:`var(--text, light-dark(#272727, #F6F6F6))`})})})}function m({...e}){let{value:n,setValue:r,max:s}=u(),c=n>=s;return(0,o.jsx)(t.Button,{"aria-label":`Increase button`,className:(0,a.css)({p:`0`,boxSize:`28px`,borderRadius:`4px`,selectors:{"&>div>div":{}}}),disabled:c,onClick:()=>r(n+1),...e,children:(0,o.jsx)(i.IconPlus,{className:(0,a.css)({color:c?`var(--base10, light-dark(#0000001A,#FFFFFF1A))`:`var(--text, light-dark(#272727, #F6F6F6))`})})})}function h({className:e,...t}){let{value:r,setValue:i,type:s}=u(),l=(0,a.css)({p:`0`,border:`none`,w:`fit-content`,h:`fit-content`,styleOrder:3}),d=s===`input`,f=d?n.Input:`div`;return d&&Object.assign(t,{allowClear:!1}),(0,o.jsx)(f,{"aria-label":`Stepper value`,className:(0,c.default)((0,a.css)({styleOrder:2,w:`60px`,textAlign:`center`,borderRadius:`6px`,selectors:{"&::-webkit-outer-spin-button, &::-webkit-inner-spin-button":{display:`none`}}}),!d&&l,e),dangerouslySetInnerHTML:d?void 0:{__html:Number(r).toString()},"data-value":r,onChange:e=>{i(Number(e.target.value))},readOnly:!d,type:`number`,value:r.toString(),...t})}exports.Stepper=d,exports.StepperContainer=f,exports.StepperDecreaseButton=p,exports.StepperIncreaseButton=m,exports.StepperInput=h,exports.useStepper=u;
|
|
@@ -1,149 +1,105 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
"use client";
|
|
3
|
+
import { Button as e } from "../Button/index.js";
|
|
4
|
+
import { Input as t } from "../Input/index.js";
|
|
5
|
+
import { IconMinus as n } from "./IconMinus.js";
|
|
6
|
+
import { IconPlus as r } from "./IconPlus.js";
|
|
7
|
+
import { Flex as i, css as a } from "@devup-ui/react";
|
|
8
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
9
|
+
import { createContext as s, useContext as c, useState as l } from "react";
|
|
10
|
+
import u from "clsx";
|
|
11
|
+
//#region src/components/Stepper/index.tsx
|
|
12
|
+
var d = s(null), f = () => {
|
|
13
|
+
let e = c(d);
|
|
14
|
+
if (!e) throw Error("useStepper must be used within a StepperProvider");
|
|
15
|
+
return e;
|
|
15
16
|
};
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{
|
|
36
|
-
value: {
|
|
37
|
-
value: n ?? u,
|
|
38
|
-
setValue: v,
|
|
39
|
-
min: r,
|
|
40
|
-
max: l,
|
|
41
|
-
type: a
|
|
42
|
-
},
|
|
43
|
-
children: e
|
|
44
|
-
}
|
|
45
|
-
);
|
|
17
|
+
function p({ children: e, defaultValue: t, value: n, onValueChange: r, min: i = 0, max: a = 100, type: s = "input" }) {
|
|
18
|
+
let [c, u] = l(t ?? 0);
|
|
19
|
+
return /* @__PURE__ */ o(d.Provider, {
|
|
20
|
+
value: {
|
|
21
|
+
value: n ?? c,
|
|
22
|
+
setValue: (e) => {
|
|
23
|
+
let t = Math.min(Math.max(e, i), a);
|
|
24
|
+
if (r) {
|
|
25
|
+
r(t);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
u(t);
|
|
29
|
+
},
|
|
30
|
+
min: i,
|
|
31
|
+
max: a,
|
|
32
|
+
type: s
|
|
33
|
+
},
|
|
34
|
+
children: e
|
|
35
|
+
});
|
|
46
36
|
}
|
|
47
|
-
function
|
|
48
|
-
|
|
37
|
+
function m(e) {
|
|
38
|
+
return /* @__PURE__ */ o(i, {
|
|
39
|
+
alignItems: "center",
|
|
40
|
+
gap: "8px",
|
|
41
|
+
styleOrder: 1,
|
|
42
|
+
...e
|
|
43
|
+
});
|
|
49
44
|
}
|
|
50
|
-
function
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
children: /* @__PURE__ */ s(
|
|
65
|
-
I,
|
|
66
|
-
{
|
|
67
|
-
className: i({
|
|
68
|
-
color: r ? "var(--base10, light-dark(#0000001A,#FFFFFF1A))" : "var(--text, light-dark(#272727, #F6F6F6))"
|
|
69
|
-
})
|
|
70
|
-
}
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
);
|
|
45
|
+
function h({ ...t }) {
|
|
46
|
+
let { value: r, setValue: i, min: s } = f(), c = r <= s;
|
|
47
|
+
return /* @__PURE__ */ o(e, {
|
|
48
|
+
"aria-label": "Decrease button",
|
|
49
|
+
className: a({
|
|
50
|
+
p: "0",
|
|
51
|
+
boxSize: "28px",
|
|
52
|
+
borderRadius: "4px"
|
|
53
|
+
}),
|
|
54
|
+
disabled: c,
|
|
55
|
+
onClick: () => i(r - 1),
|
|
56
|
+
...t,
|
|
57
|
+
children: /* @__PURE__ */ o(n, { className: a({ color: c ? "var(--base10, light-dark(#0000001A,#FFFFFF1A))" : "var(--text, light-dark(#272727, #F6F6F6))" }) })
|
|
58
|
+
});
|
|
74
59
|
}
|
|
75
|
-
function
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
onClick: () => n(t + 1),
|
|
91
|
-
...e,
|
|
92
|
-
children: /* @__PURE__ */ s(
|
|
93
|
-
k,
|
|
94
|
-
{
|
|
95
|
-
className: i({
|
|
96
|
-
color: r ? "var(--base10, light-dark(#0000001A,#FFFFFF1A))" : "var(--text, light-dark(#272727, #F6F6F6))"
|
|
97
|
-
})
|
|
98
|
-
}
|
|
99
|
-
)
|
|
100
|
-
}
|
|
101
|
-
);
|
|
60
|
+
function g({ ...t }) {
|
|
61
|
+
let { value: n, setValue: i, max: s } = f(), c = n >= s;
|
|
62
|
+
return /* @__PURE__ */ o(e, {
|
|
63
|
+
"aria-label": "Increase button",
|
|
64
|
+
className: a({
|
|
65
|
+
p: "0",
|
|
66
|
+
boxSize: "28px",
|
|
67
|
+
borderRadius: "4px",
|
|
68
|
+
selectors: { "&>div>div": {} }
|
|
69
|
+
}),
|
|
70
|
+
disabled: c,
|
|
71
|
+
onClick: () => i(n + 1),
|
|
72
|
+
...t,
|
|
73
|
+
children: /* @__PURE__ */ o(r, { className: a({ color: c ? "var(--base10, light-dark(#0000001A,#FFFFFF1A))" : "var(--text, light-dark(#272727, #F6F6F6))" }) })
|
|
74
|
+
});
|
|
102
75
|
}
|
|
103
|
-
function
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
dangerouslySetInnerHTML: a ? void 0 : { __html: Number(n).toString() },
|
|
131
|
-
"data-value": n,
|
|
132
|
-
onChange: (p) => {
|
|
133
|
-
o(Number(p.target.value));
|
|
134
|
-
},
|
|
135
|
-
readOnly: !a,
|
|
136
|
-
type: "number",
|
|
137
|
-
value: n.toString(),
|
|
138
|
-
...t
|
|
139
|
-
}
|
|
140
|
-
);
|
|
76
|
+
function _({ className: e, ...n }) {
|
|
77
|
+
let { value: r, setValue: i, type: s } = f(), c = a({
|
|
78
|
+
p: "0",
|
|
79
|
+
border: "none",
|
|
80
|
+
w: "fit-content",
|
|
81
|
+
h: "fit-content",
|
|
82
|
+
styleOrder: 3
|
|
83
|
+
}), l = s === "input", d = l ? t : "div";
|
|
84
|
+
return l && Object.assign(n, { allowClear: !1 }), /* @__PURE__ */ o(d, {
|
|
85
|
+
"aria-label": "Stepper value",
|
|
86
|
+
className: u(a({
|
|
87
|
+
styleOrder: 2,
|
|
88
|
+
w: "60px",
|
|
89
|
+
textAlign: "center",
|
|
90
|
+
borderRadius: "6px",
|
|
91
|
+
selectors: { "&::-webkit-outer-spin-button, &::-webkit-inner-spin-button": { display: "none" } }
|
|
92
|
+
}), !l && c, e),
|
|
93
|
+
dangerouslySetInnerHTML: l ? void 0 : { __html: Number(r).toString() },
|
|
94
|
+
"data-value": r,
|
|
95
|
+
onChange: (e) => {
|
|
96
|
+
i(Number(e.target.value));
|
|
97
|
+
},
|
|
98
|
+
readOnly: !l,
|
|
99
|
+
type: "number",
|
|
100
|
+
value: r.toString(),
|
|
101
|
+
...n
|
|
102
|
+
});
|
|
141
103
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
P as StepperContainer,
|
|
145
|
-
R as StepperDecreaseButton,
|
|
146
|
-
j as StepperIncreaseButton,
|
|
147
|
-
D as StepperInput,
|
|
148
|
-
c as useStepper
|
|
149
|
-
};
|
|
104
|
+
//#endregion
|
|
105
|
+
export { p as Stepper, m as StepperContainer, h as StepperDecreaseButton, g as StepperIncreaseButton, _ as StepperInput, f as useStepper };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),o=require("@devup-ui/react");function g({typography:d,error:t=!1,errorMessage:l,colors:r,disabled:i,className:n,classNames:e,rows:b=3,...s}){return a.jsxs(o.Box,{className:e?.container,display:"inline-block",pos:"relative",selectors:{"&, & *":{boxSizing:"border-box"}},w:"100%",children:[a.jsx(o.Box,{_disabled:{_placeholder:{color:"var(--disabledText, light-dark(#D6D7DE, #373737))"},bg:"var(--disabledBg, light-dark(#F0F0F3, #414244))",borderColor:"var(--border, light-dark(#E4E4E4, #434343))",color:"var(--disabledText, light-dark(#D6D7DE, #373737))",cursor:"not-allowed",opacity:.5},_focus:{borderColor:"var(--primary, light-dark(#674DC7, #8163E1))",boxShadow:"0 0 0 3px var(--focusRing, light-dark(rgba(103, 77, 199, 0.15), rgba(129, 99, 225, 0.25)))",outline:"none"},_hover:!i&&{borderColor:"var(--primary, light-dark(#674DC7, #8163E1))"},_placeholder:{color:"var(--placeholder, light-dark(#A9A8AB, #CBCBCB))"},"aria-invalid":t||void 0,"aria-label":"textarea",as:"textarea",bg:"var(--background, light-dark(#FFFFFF, #2E2E2E))",borderColor:"var(--border, light-dark(#E4E4E4, #434343))",borderRadius:"8px",borderStyle:"solid",borderWidth:"1px",className:`${n||""} ${e?.textarea||""}`.trim(),color:"var(--text, light-dark(#272727, #F6F6F6))",disabled:i,fontSize:["16px",null,null,null,"14px"],lineHeight:"1.5",minH:"80px",p:"12px",rows:b,selectors:{'&[aria-invalid="true"]':{borderColor:"var(--error, light-dark(#D52B2E, #FF5B5E))"},'&[aria-invalid="true"]:focus':{borderColor:"var(--error, light-dark(#D52B2E, #FF5B5E))",boxShadow:"0 0 0 3px var(--focusRing, light-dark(rgba(213, 43, 46, 0.2), rgba(255, 91, 94, 0.4)))"}},styleOrder:1,styleVars:{primary:r?.primary,error:r?.error,text:r?.text,border:r?.border,background:r?.background,placeholder:r?.placeholder,focusRing:r?.focusRing},transition:"border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out",typography:d,w:"100%",...s}),t&&l&&a.jsx(o.Text,{"aria-label":"error-message",bottom:"-8px",className:e?.errorMessage,color:"var(--error, light-dark(#D52B2E, #FF5B5E))",fontSize:"12px",left:"0",pos:"absolute",styleOrder:1,transform:"translateY(100%)",children:l})]})}exports.Textarea=g;
|
|
1
|
+
"use client";"use client";require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`@devup-ui/react`),t=require(`react/jsx-runtime`);function n({typography:n,error:r=!1,errorMessage:i,colors:a,disabled:o,className:s,classNames:c,rows:l=3,...u}){return(0,t.jsxs)(e.Box,{className:c?.container,display:`inline-block`,pos:`relative`,selectors:{"&, & *":{boxSizing:`border-box`}},w:`100%`,children:[(0,t.jsx)(e.Box,{_disabled:{_placeholder:{color:`var(--disabledText, light-dark(#D6D7DE, #373737))`},bg:`var(--disabledBg, light-dark(#F0F0F3, #414244))`,borderColor:`var(--border, light-dark(#E4E4E4, #434343))`,color:`var(--disabledText, light-dark(#D6D7DE, #373737))`,cursor:`not-allowed`,opacity:.5},_focus:{borderColor:`var(--primary, light-dark(#674DC7, #8163E1))`,boxShadow:`0 0 0 3px var(--focusRing, light-dark(rgba(103, 77, 199, 0.15), rgba(129, 99, 225, 0.25)))`,outline:`none`},_hover:!o&&{borderColor:`var(--primary, light-dark(#674DC7, #8163E1))`},_placeholder:{color:`var(--placeholder, light-dark(#A9A8AB, #CBCBCB))`},"aria-invalid":r||void 0,"aria-label":`textarea`,as:`textarea`,bg:`var(--background, light-dark(#FFFFFF, #2E2E2E))`,borderColor:`var(--border, light-dark(#E4E4E4, #434343))`,borderRadius:`8px`,borderStyle:`solid`,borderWidth:`1px`,className:`${s||``} ${c?.textarea||``}`.trim(),color:`var(--text, light-dark(#272727, #F6F6F6))`,disabled:o,fontSize:[`16px`,null,null,null,`14px`],lineHeight:`1.5`,minH:`80px`,p:`12px`,rows:l,selectors:{'&[aria-invalid="true"]':{borderColor:`var(--error, light-dark(#D52B2E, #FF5B5E))`},'&[aria-invalid="true"]:focus':{borderColor:`var(--error, light-dark(#D52B2E, #FF5B5E))`,boxShadow:`0 0 0 3px var(--focusRing, light-dark(rgba(213, 43, 46, 0.2), rgba(255, 91, 94, 0.4)))`}},styleOrder:1,styleVars:{primary:a?.primary,error:a?.error,text:a?.text,border:a?.border,background:a?.background,placeholder:a?.placeholder,focusRing:a?.focusRing},transition:`border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out`,typography:n,w:`100%`,...u}),r&&i&&(0,t.jsx)(e.Text,{"aria-label":`error-message`,bottom:`-8px`,className:c?.errorMessage,color:`var(--error, light-dark(#D52B2E, #FF5B5E))`,fontSize:`12px`,left:`0`,pos:`absolute`,styleOrder:1,transform:`translateY(100%)`,children:i})]})}exports.Textarea=n;
|
|
@@ -1,110 +1,87 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
import { Box as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
w: "100%",
|
|
86
|
-
...s
|
|
87
|
-
}
|
|
88
|
-
),
|
|
89
|
-
e && o && /* @__PURE__ */ i(
|
|
90
|
-
x,
|
|
91
|
-
{
|
|
92
|
-
"aria-label": "error-message",
|
|
93
|
-
bottom: "-8px",
|
|
94
|
-
className: a?.errorMessage,
|
|
95
|
-
color: "var(--error, light-dark(#D52B2E, #FF5B5E))",
|
|
96
|
-
fontSize: "12px",
|
|
97
|
-
left: "0",
|
|
98
|
-
pos: "absolute",
|
|
99
|
-
styleOrder: 1,
|
|
100
|
-
transform: "translateY(100%)",
|
|
101
|
-
children: o
|
|
102
|
-
}
|
|
103
|
-
)
|
|
104
|
-
]
|
|
105
|
-
}
|
|
106
|
-
);
|
|
2
|
+
"use client";
|
|
3
|
+
import { Box as e, Text as t } from "@devup-ui/react";
|
|
4
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/Textarea/index.tsx
|
|
6
|
+
function i({ typography: i, error: a = !1, errorMessage: o, colors: s, disabled: c, className: l, classNames: u, rows: d = 3, ...f }) {
|
|
7
|
+
return /* @__PURE__ */ r(e, {
|
|
8
|
+
className: u?.container,
|
|
9
|
+
display: "inline-block",
|
|
10
|
+
pos: "relative",
|
|
11
|
+
selectors: { "&, & *": { boxSizing: "border-box" } },
|
|
12
|
+
w: "100%",
|
|
13
|
+
children: [/* @__PURE__ */ n(e, {
|
|
14
|
+
_disabled: {
|
|
15
|
+
_placeholder: { color: "var(--disabledText, light-dark(#D6D7DE, #373737))" },
|
|
16
|
+
bg: "var(--disabledBg, light-dark(#F0F0F3, #414244))",
|
|
17
|
+
borderColor: "var(--border, light-dark(#E4E4E4, #434343))",
|
|
18
|
+
color: "var(--disabledText, light-dark(#D6D7DE, #373737))",
|
|
19
|
+
cursor: "not-allowed",
|
|
20
|
+
opacity: .5
|
|
21
|
+
},
|
|
22
|
+
_focus: {
|
|
23
|
+
borderColor: "var(--primary, light-dark(#674DC7, #8163E1))",
|
|
24
|
+
boxShadow: "0 0 0 3px var(--focusRing, light-dark(rgba(103, 77, 199, 0.15), rgba(129, 99, 225, 0.25)))",
|
|
25
|
+
outline: "none"
|
|
26
|
+
},
|
|
27
|
+
_hover: !c && { borderColor: "var(--primary, light-dark(#674DC7, #8163E1))" },
|
|
28
|
+
_placeholder: { color: "var(--placeholder, light-dark(#A9A8AB, #CBCBCB))" },
|
|
29
|
+
"aria-invalid": a || void 0,
|
|
30
|
+
"aria-label": "textarea",
|
|
31
|
+
as: "textarea",
|
|
32
|
+
bg: "var(--background, light-dark(#FFFFFF, #2E2E2E))",
|
|
33
|
+
borderColor: "var(--border, light-dark(#E4E4E4, #434343))",
|
|
34
|
+
borderRadius: "8px",
|
|
35
|
+
borderStyle: "solid",
|
|
36
|
+
borderWidth: "1px",
|
|
37
|
+
className: `${l || ""} ${u?.textarea || ""}`.trim(),
|
|
38
|
+
color: "var(--text, light-dark(#272727, #F6F6F6))",
|
|
39
|
+
disabled: c,
|
|
40
|
+
fontSize: [
|
|
41
|
+
"16px",
|
|
42
|
+
null,
|
|
43
|
+
null,
|
|
44
|
+
null,
|
|
45
|
+
"14px"
|
|
46
|
+
],
|
|
47
|
+
lineHeight: "1.5",
|
|
48
|
+
minH: "80px",
|
|
49
|
+
p: "12px",
|
|
50
|
+
rows: d,
|
|
51
|
+
selectors: {
|
|
52
|
+
"&[aria-invalid=\"true\"]": { borderColor: "var(--error, light-dark(#D52B2E, #FF5B5E))" },
|
|
53
|
+
"&[aria-invalid=\"true\"]:focus": {
|
|
54
|
+
borderColor: "var(--error, light-dark(#D52B2E, #FF5B5E))",
|
|
55
|
+
boxShadow: "0 0 0 3px var(--focusRing, light-dark(rgba(213, 43, 46, 0.2), rgba(255, 91, 94, 0.4)))"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
styleOrder: 1,
|
|
59
|
+
styleVars: {
|
|
60
|
+
primary: s?.primary,
|
|
61
|
+
error: s?.error,
|
|
62
|
+
text: s?.text,
|
|
63
|
+
border: s?.border,
|
|
64
|
+
background: s?.background,
|
|
65
|
+
placeholder: s?.placeholder,
|
|
66
|
+
focusRing: s?.focusRing
|
|
67
|
+
},
|
|
68
|
+
transition: "border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out",
|
|
69
|
+
typography: i,
|
|
70
|
+
w: "100%",
|
|
71
|
+
...f
|
|
72
|
+
}), a && o && /* @__PURE__ */ n(t, {
|
|
73
|
+
"aria-label": "error-message",
|
|
74
|
+
bottom: "-8px",
|
|
75
|
+
className: u?.errorMessage,
|
|
76
|
+
color: "var(--error, light-dark(#D52B2E, #FF5B5E))",
|
|
77
|
+
fontSize: "12px",
|
|
78
|
+
left: "0",
|
|
79
|
+
pos: "absolute",
|
|
80
|
+
styleOrder: 1,
|
|
81
|
+
transform: "translateY(100%)",
|
|
82
|
+
children: o
|
|
83
|
+
})]
|
|
84
|
+
});
|
|
107
85
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
};
|
|
86
|
+
//#endregion
|
|
87
|
+
export { i as Textarea };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),t=require("@devup-ui/react"),y=require("react");function f({defaultValue:l=null,value:o=null,onChange:s,disabled:n,className:g,style:p,variant:d="default",colors:r,classNames:u,styles:x}){const[b,v]=y.useState(o??l??!1),e=o??b;function c(h){s?.(!h),v(m=>!m)}const a=d==="default";return i.jsxs(i.Fragment,{children:[i.jsx(t.Box,{"aria-disabled":n,bg:e?"var(--primary)":"var(--bg, light-dark(#E4E4E4, #383838))",borderRadius:"500px",boxSizing:"border-box",className:g,cursor:"pointer",h:a?"28px":"8px",justifyContent:e&&"flex-end",onClick:()=>!n&&c(e),p:a&&1,position:"relative",role:"group",selectors:{"&[aria-disabled=true]":{cursor:"not-allowed",bg:"var(--disabledBg, light-dark(#D6D7DE, #373737))"},"&:hover:not([aria-disabled=true]):not(:disabled)":{bg:e?"var(--primaryHoverBg, light-dark(color-mix(in srgb, var(--primary) 100%, #000 15%), color-mix(in srgb, var(--primary) 100%, #FFF 15%)))":"var(--hoverBg, light-dark(#C3C2C8, #696A6F))"}},style:p,styleVars:{primary:r?.primary,bg:r?.bg,primaryHoverBg:r?.primaryHoverBg,hoverBg:r?.hoverBg,disabledBg:r?.disabledBg},"test-id":"toggle-wrapper",transition:".25s",w:a?"50px":"40px",children:i.jsx(t.Box,{_groupHover:!a&&{outline:"4px solid",outlineColor:"var(--switchHoverOutline, light-dark(color-mix(in srgb, var(--primary) 20%, transparent), color-mix(in srgb, var(--primary) 50%, transparent)))"},backgroundColor:"#fff",borderRadius:"100%",boxSize:"20px",className:u?.toggle,filter:!a&&"drop-shadow(0px 0px 3px var(--switchShadow, rgba(0, 0, 0, 0.10)));",outline:"4px",pos:"absolute",style:x?.toggle,styleVars:{primary:r?.primary,primaryHoverBg:r?.primaryHoverBg,switchShadow:r?.switchShadow,switchHoverOutline:r?.switchHoverOutline},top:!a&&"-6px",transform:e&&"translateX(calc(100% + 2px))",transition:".25s"})}),i.jsx(t.Input,{type:"hidden",value:String(e)})]})}exports.Toggle=f;
|
|
1
|
+
"use client";"use client";require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`@devup-ui/react`),t=require(`react/jsx-runtime`),n=require(`react`);function r({defaultValue:r=null,value:i=null,onChange:a,disabled:o,className:s,style:c,variant:l=`default`,colors:u,classNames:d,styles:f}){let[p,m]=(0,n.useState)(i??r??!1),h=i??p;function g(e){a?.(!e),m(e=>!e)}let _=l===`default`;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(e.Box,{"aria-disabled":o,bg:h?`var(--primary)`:`var(--bg, light-dark(#E4E4E4, #383838))`,borderRadius:`500px`,boxSizing:`border-box`,className:s,cursor:`pointer`,h:_?`28px`:`8px`,justifyContent:h&&`flex-end`,onClick:()=>!o&&g(h),p:_&&1,position:`relative`,role:`group`,selectors:{"&[aria-disabled=true]":{cursor:`not-allowed`,bg:`var(--disabledBg, light-dark(#D6D7DE, #373737))`},"&:hover:not([aria-disabled=true]):not(:disabled)":{bg:h?`var(--primaryHoverBg, light-dark(color-mix(in srgb, var(--primary) 100%, #000 15%), color-mix(in srgb, var(--primary) 100%, #FFF 15%)))`:`var(--hoverBg, light-dark(#C3C2C8, #696A6F))`}},style:c,styleVars:{primary:u?.primary,bg:u?.bg,primaryHoverBg:u?.primaryHoverBg,hoverBg:u?.hoverBg,disabledBg:u?.disabledBg},"test-id":`toggle-wrapper`,transition:`.25s`,w:_?`50px`:`40px`,children:(0,t.jsx)(e.Box,{_groupHover:!_&&{outline:`4px solid`,outlineColor:`var(--switchHoverOutline, light-dark(color-mix(in srgb, var(--primary) 20%, transparent), color-mix(in srgb, var(--primary) 50%, transparent)))`},backgroundColor:`#fff`,borderRadius:`100%`,boxSize:`20px`,className:d?.toggle,filter:!_&&`drop-shadow(0px 0px 3px var(--switchShadow, rgba(0, 0, 0, 0.10)));`,outline:`4px`,pos:`absolute`,style:f?.toggle,styleVars:{primary:u?.primary,primaryHoverBg:u?.primaryHoverBg,switchShadow:u?.switchShadow,switchHoverOutline:u?.switchHoverOutline},top:!_&&`-6px`,transform:h&&`translateX(calc(100% + 2px))`,transition:`.25s`})}),(0,t.jsx)(e.Input,{type:`hidden`,value:String(h)})]})}exports.Toggle=r;
|