@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,195 +1,144 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
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
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
primary: r?.primary,
|
|
143
|
-
border: r?.border,
|
|
144
|
-
text: r?.text,
|
|
145
|
-
bg: r?.bg,
|
|
146
|
-
hoverBg: r?.hoverBg,
|
|
147
|
-
hoverBorder: r?.hoverBorder,
|
|
148
|
-
hoverColor: r?.hoverColor,
|
|
149
|
-
checkedBg: r?.checkedBg,
|
|
150
|
-
checkedBorder: r?.checkedBorder,
|
|
151
|
-
checkedColor: r?.checkedColor,
|
|
152
|
-
disabledBg: r?.disabledBg,
|
|
153
|
-
disabledColor: r?.disabledColor
|
|
154
|
-
},
|
|
155
|
-
transition: "background-color 0.25s, border-color 0.25s",
|
|
156
|
-
w: "fit-content",
|
|
157
|
-
children: i
|
|
158
|
-
}
|
|
159
|
-
) : /* @__PURE__ */ a(
|
|
160
|
-
B,
|
|
161
|
-
{
|
|
162
|
-
"aria-disabled": e,
|
|
163
|
-
className: p?.label,
|
|
164
|
-
color: "var(--text, light-dark(#000, #fff))",
|
|
165
|
-
selectors: {
|
|
166
|
-
"&[aria-disabled=true]": {
|
|
167
|
-
color: "var(--disabledColor, light-dark(#D6D7DE, #373737))"
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
style: l,
|
|
171
|
-
styleOrder: 1,
|
|
172
|
-
styleVars: {
|
|
173
|
-
primary: r?.primary,
|
|
174
|
-
border: r?.border,
|
|
175
|
-
text: r?.text,
|
|
176
|
-
bg: r?.bg,
|
|
177
|
-
hoverBg: r?.hoverBg,
|
|
178
|
-
hoverBorder: r?.hoverBorder,
|
|
179
|
-
hoverColor: r?.hoverColor,
|
|
180
|
-
checkedBg: r?.checkedBg,
|
|
181
|
-
checkedBorder: r?.checkedBorder,
|
|
182
|
-
checkedColor: r?.checkedColor,
|
|
183
|
-
disabledBg: r?.disabledBg,
|
|
184
|
-
disabledColor: r?.disabledColor
|
|
185
|
-
},
|
|
186
|
-
children: i
|
|
187
|
-
}
|
|
188
|
-
)
|
|
189
|
-
]
|
|
190
|
-
}
|
|
191
|
-
);
|
|
1
|
+
import { Box as e, Input as t, Text as n } from "@devup-ui/react";
|
|
2
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/Radio/index.tsx
|
|
4
|
+
function a({ className: a, disabled: o, children: s, variant: c = "default", checked: l, classNames: u, styles: d, style: f, firstButton: p, lastButton: m, colors: h, ...g }) {
|
|
5
|
+
let _ = c === "button";
|
|
6
|
+
return /* @__PURE__ */ i(e, {
|
|
7
|
+
alignItems: _ ? void 0 : "center",
|
|
8
|
+
"aria-disabled": o,
|
|
9
|
+
as: "label",
|
|
10
|
+
cursor: _ ? void 0 : "pointer",
|
|
11
|
+
display: _ ? void 0 : "inline-flex",
|
|
12
|
+
gap: _ ? void 0 : 2,
|
|
13
|
+
selectors: { "&[aria-disabled=true]": { cursor: "default" } },
|
|
14
|
+
children: [_ ? /* @__PURE__ */ r(t, {
|
|
15
|
+
checked: l,
|
|
16
|
+
className: a,
|
|
17
|
+
"data-radio-input": !0,
|
|
18
|
+
disabled: o,
|
|
19
|
+
display: "none",
|
|
20
|
+
opacity: 0,
|
|
21
|
+
styleOrder: 1,
|
|
22
|
+
type: "radio",
|
|
23
|
+
...g
|
|
24
|
+
}) : /* @__PURE__ */ r(t, {
|
|
25
|
+
_focus: { outline: "1px sold var(--border, var(--primary))" },
|
|
26
|
+
appearance: "none",
|
|
27
|
+
bg: "light-dark(#fff, #2E2E2E)",
|
|
28
|
+
border: "1px solid",
|
|
29
|
+
borderColor: "$border",
|
|
30
|
+
borderRadius: "100%",
|
|
31
|
+
checked: l,
|
|
32
|
+
className: a,
|
|
33
|
+
"data-radio-input": !0,
|
|
34
|
+
disabled: o,
|
|
35
|
+
height: "18px",
|
|
36
|
+
m: 0,
|
|
37
|
+
selectors: {
|
|
38
|
+
"&:checked:not(:disabled)": {
|
|
39
|
+
bg: "var(--checkedBg, var(--primary, light-dark(#fff, #2E2E2E)))",
|
|
40
|
+
border: "3px solid",
|
|
41
|
+
borderColor: "var(--checkedBg, light-dark(#fff, #2E2E2E))",
|
|
42
|
+
boxShadow: "0 0 0 1px var(--checkedBorder, var(--primary))"
|
|
43
|
+
},
|
|
44
|
+
"&:hover:not(:disabled,:checked)": {
|
|
45
|
+
border: "1px solid var(--hoverBorder, var(--primary))",
|
|
46
|
+
bg: "var(--hoverBg, light-dark(color-mix(in srgb, var(--primary) 10%, white 90%), color-mix(in srgb, var(--primary) 10%, black 90%)))"
|
|
47
|
+
},
|
|
48
|
+
"&:is(:disabled, [aria-disabled=true])": { bgColor: "var(--disabledBg, light-dark(#F0F0F3, #47474A))" }
|
|
49
|
+
},
|
|
50
|
+
styleOrder: 1,
|
|
51
|
+
styleVars: {
|
|
52
|
+
primary: h?.primary,
|
|
53
|
+
border: h?.border,
|
|
54
|
+
text: h?.text,
|
|
55
|
+
bg: h?.bg,
|
|
56
|
+
hoverBg: h?.hoverBg,
|
|
57
|
+
hoverBorder: h?.hoverBorder,
|
|
58
|
+
hoverColor: h?.hoverColor,
|
|
59
|
+
checkedBg: h?.checkedBg,
|
|
60
|
+
checkedBorder: h?.checkedBorder,
|
|
61
|
+
checkedColor: h?.checkedColor,
|
|
62
|
+
disabledBg: h?.disabledBg,
|
|
63
|
+
disabledColor: h?.disabledColor
|
|
64
|
+
},
|
|
65
|
+
transition: ".25s",
|
|
66
|
+
type: "radio",
|
|
67
|
+
width: "18px",
|
|
68
|
+
...g
|
|
69
|
+
}), c === "button" ? /* @__PURE__ */ r(e, {
|
|
70
|
+
_disabled: { cursor: "not-allowed" },
|
|
71
|
+
"aria-disabled": o,
|
|
72
|
+
bg: "var(--bg, light-dark(#fff, #2E2E2E))",
|
|
73
|
+
border: "1px solid",
|
|
74
|
+
borderColor: "$border",
|
|
75
|
+
borderRadius: p ? "8px 0 0 8px" : m ? "0 8px 8px 0" : void 0,
|
|
76
|
+
className: a,
|
|
77
|
+
color: "var(--text, light-dark(#000, #fff))",
|
|
78
|
+
cursor: "pointer",
|
|
79
|
+
"data-radio-button": !0,
|
|
80
|
+
display: "flex",
|
|
81
|
+
px: 8,
|
|
82
|
+
py: 3,
|
|
83
|
+
selectors: {
|
|
84
|
+
"[data-radio-input]:checked + &:not([aria-disabled=true])": {
|
|
85
|
+
fontWeight: 600,
|
|
86
|
+
bg: "var(--checkedBg, light-dark(color-mix(in srgb, var(--primary) 10%, white 80%), color-mix(in srgb, var(--primary) 10%, black 80%)))",
|
|
87
|
+
borderColor: "var(--checkedBorder, var(--primary))",
|
|
88
|
+
color: "var(--checkedColor, var(--primary))"
|
|
89
|
+
},
|
|
90
|
+
"&:hover:not([aria-disabled=true])": {
|
|
91
|
+
bg: "var(--hoverBg, light-dark(color-mix(in srgb, var(--primary) 10%, white 90%), color-mix(in srgb, var(--primary) 10%, black 90%)))",
|
|
92
|
+
borderColor: "var(--hoverBorder, var(--primary))"
|
|
93
|
+
},
|
|
94
|
+
"[data-radio-input]:disabled + &": {
|
|
95
|
+
bg: "var(--disabledBg, light-dark(#F0F0F3, #47474A))",
|
|
96
|
+
color: "var(--disabledColor, light-dark(#D6D7DE, #373737))"
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
style: f,
|
|
100
|
+
styleOrder: 1,
|
|
101
|
+
styleVars: {
|
|
102
|
+
primary: h?.primary,
|
|
103
|
+
border: h?.border,
|
|
104
|
+
text: h?.text,
|
|
105
|
+
bg: h?.bg,
|
|
106
|
+
hoverBg: h?.hoverBg,
|
|
107
|
+
hoverBorder: h?.hoverBorder,
|
|
108
|
+
hoverColor: h?.hoverColor,
|
|
109
|
+
checkedBg: h?.checkedBg,
|
|
110
|
+
checkedBorder: h?.checkedBorder,
|
|
111
|
+
checkedColor: h?.checkedColor,
|
|
112
|
+
disabledBg: h?.disabledBg,
|
|
113
|
+
disabledColor: h?.disabledColor
|
|
114
|
+
},
|
|
115
|
+
transition: "background-color 0.25s, border-color 0.25s",
|
|
116
|
+
w: "fit-content",
|
|
117
|
+
children: s
|
|
118
|
+
}) : /* @__PURE__ */ r(n, {
|
|
119
|
+
"aria-disabled": o,
|
|
120
|
+
className: u?.label,
|
|
121
|
+
color: "var(--text, light-dark(#000, #fff))",
|
|
122
|
+
selectors: { "&[aria-disabled=true]": { color: "var(--disabledColor, light-dark(#D6D7DE, #373737))" } },
|
|
123
|
+
style: f,
|
|
124
|
+
styleOrder: 1,
|
|
125
|
+
styleVars: {
|
|
126
|
+
primary: h?.primary,
|
|
127
|
+
border: h?.border,
|
|
128
|
+
text: h?.text,
|
|
129
|
+
bg: h?.bg,
|
|
130
|
+
hoverBg: h?.hoverBg,
|
|
131
|
+
hoverBorder: h?.hoverBorder,
|
|
132
|
+
hoverColor: h?.hoverColor,
|
|
133
|
+
checkedBg: h?.checkedBg,
|
|
134
|
+
checkedBorder: h?.checkedBorder,
|
|
135
|
+
checkedColor: h?.checkedColor,
|
|
136
|
+
disabledBg: h?.disabledBg,
|
|
137
|
+
disabledColor: h?.disabledColor
|
|
138
|
+
},
|
|
139
|
+
children: s
|
|
140
|
+
})]
|
|
141
|
+
});
|
|
192
142
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
};
|
|
143
|
+
//#endregion
|
|
144
|
+
export { a as Radio };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),w=require("@devup-ui/react"),V=require("react"),a=require("../Radio/index.cjs");function y({disabled:u,options:i,direction:c="row",variant:t="default",style:S,value:n,onChange:f,defaultValue:s,colors:g,className:j,classNames:d,styles:h}){const[R,q]=V.useState(n?String(n):s?String(s):void 0),b=n?String(n):R??"";function m(e){f?.(e),q(e)}return o.jsx(w.Flex,{className:d?.container,flexDir:t==="button"?"row":c,gap:t==="button"?0:c==="row"?"30px":"16px",style:h?.container,children:i.map(({value:e,label:l},p)=>{const r=String(e),x={checked:b===r,disabled:u,onChange:()=>!u&&m(r),className:j,classNames:d,styles:h,style:S};return t==="button"?o.jsx(a.Radio,{colors:g,firstButton:p===0,lastButton:p===i.length-1,variant:t,...x,children:l},r):o.jsx(a.Radio,{colors:g,variant:t,...x,children:l},r)})})}exports.RadioGroup=y;
|
|
1
|
+
"use client";"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../Radio/index.cjs`);let t=require(`@devup-ui/react`),n=require(`react/jsx-runtime`),r=require(`react`);function i({disabled:i,options:a,direction:o=`row`,variant:s=`default`,style:c,value:l,onChange:u,defaultValue:d,colors:f,className:p,classNames:m,styles:h}){let[g,_]=(0,r.useState)(l?String(l):d?String(d):void 0),v=l?String(l):g??``;function y(e){u?.(e),_(e)}return(0,n.jsx)(t.Flex,{className:m?.container,flexDir:s===`button`?`row`:o,gap:s===`button`?0:o===`row`?`30px`:`16px`,style:h?.container,children:a.map(({value:t,label:r},o)=>{let l=String(t),u={checked:v===l,disabled:i,onChange:()=>!i&&y(l),className:p,classNames:m,styles:h,style:c};return s===`button`?(0,n.jsx)(e.Radio,{colors:f,firstButton:o===0,lastButton:o===a.length-1,variant:s,...u,children:r},l):(0,n.jsx)(e.Radio,{colors:f,variant:s,...u,children:r},l)})})}exports.RadioGroup=i;
|
|
@@ -1,61 +1,45 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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
|
-
return t === "button" ? /* @__PURE__ */ e(
|
|
44
|
-
x,
|
|
45
|
-
{
|
|
46
|
-
colors: g,
|
|
47
|
-
firstButton: s === 0,
|
|
48
|
-
lastButton: s === u.length - 1,
|
|
49
|
-
variant: t,
|
|
50
|
-
...l,
|
|
51
|
-
children: h
|
|
52
|
-
},
|
|
53
|
-
o
|
|
54
|
-
) : /* @__PURE__ */ e(x, { colors: g, variant: t, ...l, children: h }, o);
|
|
55
|
-
})
|
|
56
|
-
}
|
|
57
|
-
);
|
|
2
|
+
"use client";
|
|
3
|
+
import { Radio as e } from "../Radio/index.js";
|
|
4
|
+
import { Flex as t } from "@devup-ui/react";
|
|
5
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
6
|
+
import { useState as r } from "react";
|
|
7
|
+
//#region src/components/RadioGroup/index.tsx
|
|
8
|
+
function i({ disabled: i, options: a, direction: o = "row", variant: s = "default", style: c, value: l, onChange: u, defaultValue: d, colors: f, className: p, classNames: m, styles: h }) {
|
|
9
|
+
let [g, _] = r(l ? String(l) : d ? String(d) : void 0), v = l ? String(l) : g ?? "";
|
|
10
|
+
function y(e) {
|
|
11
|
+
u?.(e), _(e);
|
|
12
|
+
}
|
|
13
|
+
return /* @__PURE__ */ n(t, {
|
|
14
|
+
className: m?.container,
|
|
15
|
+
flexDir: s === "button" ? "row" : o,
|
|
16
|
+
gap: s === "button" ? 0 : o === "row" ? "30px" : "16px",
|
|
17
|
+
style: h?.container,
|
|
18
|
+
children: a.map(({ value: t, label: r }, o) => {
|
|
19
|
+
let l = String(t), u = {
|
|
20
|
+
checked: v === l,
|
|
21
|
+
disabled: i,
|
|
22
|
+
onChange: () => !i && y(l),
|
|
23
|
+
className: p,
|
|
24
|
+
classNames: m,
|
|
25
|
+
styles: h,
|
|
26
|
+
style: c
|
|
27
|
+
};
|
|
28
|
+
return s === "button" ? /* @__PURE__ */ n(e, {
|
|
29
|
+
colors: f,
|
|
30
|
+
firstButton: o === 0,
|
|
31
|
+
lastButton: o === a.length - 1,
|
|
32
|
+
variant: s,
|
|
33
|
+
...u,
|
|
34
|
+
children: r
|
|
35
|
+
}, l) : /* @__PURE__ */ n(e, {
|
|
36
|
+
colors: f,
|
|
37
|
+
variant: s,
|
|
38
|
+
...u,
|
|
39
|
+
children: r
|
|
40
|
+
}, l);
|
|
41
|
+
})
|
|
42
|
+
});
|
|
58
43
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
};
|
|
44
|
+
//#endregion
|
|
45
|
+
export { i as RadioGroup };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
require(`../../_virtual/_rolldown/runtime.cjs`);let e=require(`react/jsx-runtime`);function t({...t}){return(0,e.jsx)(`svg`,{fill:`none`,height:`10`,viewBox:`0 0 12 10`,width:`12`,xmlns:`http://www.w3.org/2000/svg`,...t,children:(0,e.jsx)(`path`,{clipRule:`evenodd`,d:`M11.6044 0.825663C12.1054 1.28367 12.1344 2.05481 11.6692 2.54805L5.4787 9.11055C5.24011 9.36348 4.90375 9.50497 4.55315 9.49987C4.20254 9.49477 3.87058 9.34356 3.63968 9.0838L0.30635 5.3338C-0.143922 4.82725 -0.0917767 4.05729 0.42282 3.61405C0.937417 3.17081 1.7196 3.22214 2.16987 3.7287L4.59876 6.4612L9.85463 0.889455C10.3199 0.396214 11.1033 0.367654 11.6044 0.825663Z`,fill:`currentColor`,fillRule:`evenodd`})})}exports.IconCheck=t;
|
|
@@ -1,26 +1,20 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
fillRule: "evenodd"
|
|
19
|
-
}
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
);
|
|
2
|
+
//#region src/components/Select/IconCheck.tsx
|
|
3
|
+
function t({ ...t }) {
|
|
4
|
+
return /* @__PURE__ */ e("svg", {
|
|
5
|
+
fill: "none",
|
|
6
|
+
height: "10",
|
|
7
|
+
viewBox: "0 0 12 10",
|
|
8
|
+
width: "12",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
...t,
|
|
11
|
+
children: /* @__PURE__ */ e("path", {
|
|
12
|
+
clipRule: "evenodd",
|
|
13
|
+
d: "M11.6044 0.825663C12.1054 1.28367 12.1344 2.05481 11.6692 2.54805L5.4787 9.11055C5.24011 9.36348 4.90375 9.50497 4.55315 9.49987C4.20254 9.49477 3.87058 9.34356 3.63968 9.0838L0.30635 5.3338C-0.143922 4.82725 -0.0917767 4.05729 0.42282 3.61405C0.937417 3.17081 1.7196 3.22214 2.16987 3.7287L4.59876 6.4612L9.85463 0.889455C10.3199 0.396214 11.1033 0.367654 11.6044 0.825663Z",
|
|
14
|
+
fill: "currentColor",
|
|
15
|
+
fillRule: "evenodd"
|
|
16
|
+
})
|
|
17
|
+
});
|
|
23
18
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { t as IconCheck };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("react"),a=require("@devup-ui/react"),q=require("clsx"),E=require("../../contexts/useSelect.cjs"),w=require("../Button/index.cjs"),j=require("./IconCheck.cjs");function z({type:r="default",children:l,defaultValue:f,value:o,onChange:c,defaultOpen:g,open:x,onOpenChange:b,colors:t,typography:d,options:s,triggerProps:k,containerProps:i,optionProps:h,...u}){const p=v.useRef(null),[F,y]=v.useState(g??!1),[m,S]=v.useState(f??(r==="checkbox"?[]:""));v.useEffect(()=>{const n=C=>{p.current&&p.current.contains(C.target)||y(!1)};return document.addEventListener("click",n),()=>document.removeEventListener("click",n)},[F,y]);const A=n=>{b?.(n),y(n)},R=n=>{if(c?.(n),r!=="default"){if(r==="radio"){S(n);return}Array.isArray(m)&&m.includes(n)?S(m.filter(C=>C!==n)):S([...m,n])}};return e.jsx(E.SelectContext.Provider,{value:{open:x??F,setOpen:A,value:o??m,setValue:R,type:r,ref:p},children:e.jsx(a.Box,{ref:p,display:"inline-block",h:"fit-content",selectors:{"&, & *":{boxSizing:"border-box"}},styleOrder:1,styleVars:{primary:t?.primary,border:t?.border,inputBackground:t?.inputBackground,base10:t?.base10,title:t?.title,selectDisabled:t?.selectDisabled,primaryBg:t?.primaryBg,inputDisabledBackground:t?.inputDisabledBackground,inputDisabledText:t?.inputDisabledText},typography:d,...u,children:s?e.jsxs(e.Fragment,{children:[e.jsx(O,{...k,children:l}),e.jsx(B,{...i,children:s?.map(n=>v.createElement(D,{...h,...n,key:"option-"+n.value},n.label??n.value))})]}):l})})}function O({className:r,children:l,asChild:f,...o}){const{open:c,setOpen:g}=E.useSelect(),x=()=>{g(!c)};if(f){const b=v.Children.only(l),t=b.type;return e.jsx(t,{"aria-expanded":c,"aria-label":"Select toggle",onClick:x,...b.props})}return e.jsx(w.Button,{"aria-expanded":c,"aria-label":"Select toggle",className:q(a.css({borderRadius:"8px",styleOrder:2}),r),onClick:x,...o,children:l})}function B({children:r,showConfirmButton:l,confirmButtonText:f="완료",x:o=0,y:c=0,...g}){const{open:x,setOpen:b,type:t,ref:d}=E.useSelect();return x?e.jsxs(a.VStack,{ref:s=>{if(!d.current||!s)return;const k=d.current,i=()=>{const{height:h,x:u,y:p,top:F,left:y}=k.getBoundingClientRect(),m=s.offsetHeight+F+window.scrollY+h+c>document.documentElement.scrollHeight,S=s.offsetWidth+y+window.scrollX+o>document.documentElement.scrollWidth;m?s.style.bottom=`${window.innerHeight-p+10}px`:s.style.top=`${p+h+10+c}px`,S?s.style.left=`${Math.max(u-s.offsetWidth+k.offsetWidth,0)+o}px`:s.style.left=`${u+o}px`};return i(),window.addEventListener("scroll",i,!0),window.addEventListener("resize",i),()=>{window.removeEventListener("scroll",i,!0),window.removeEventListener("resize",i)}},"aria-label":"Select container",bg:"var(--inputBg, light-dark(#FFF,#2E2E2E))",border:"1px solid var(--border, light-dark(#E4E4E4,#434343))",borderRadius:"8px",bottom:"-4px",boxShadow:"0 2px 2px 0 var(--base10, light-dark(#0000001A,#FFFFFF1A))",boxSize:"fit-content",gap:"6px",minW:"232px",p:"10px",pos:"fixed",styleOrder:1,userSelect:"none",zIndex:1,...g,children:[r,l&&t==="checkbox"&&e.jsx(a.Flex,{justifyContent:"end",w:"100%",children:e.jsx(w.Button,{"aria-label":"Select confirm button",className:a.css({textAlign:"end",bg:"var(--primary, light-dark(#674DC7, #8163E1))",borderRadius:"8px",w:"fit-content",px:"30px",py:"10px",color:"#FFF",typography:"buttonS"}),onClick:()=>b(!1),variant:"primary",children:f})})]}):null}function D({disabled:r,onClick:l,children:f,value:o,showCheck:c=!0,...g}){const{setOpen:x,setValue:b,value:t,type:d}=E.useSelect(),s=()=>{d!=="checkbox"&&x(!1)},k=(u,p)=>{if(l){l(u,p);return}typeof u=="string"&&b(u),s()},i={default:!1,radio:t===o,checkbox:Array.isArray(t)&&o&&t.includes(o)}[d],h=!r&&!(d==="radio"&&i);return e.jsxs(a.Flex,{_hover:h&&{bg:"var(--primaryBg, light-dark(#F4F3FA, #F4F3FA0D))"},alignItems:"center","aria-label":"Select option",borderRadius:"6px",color:r?"var(--selectDisabled, light-dark(#C4C5D1, #45464D))":i?"var(--primary, light-dark(#674DC7, #8163E1)":"var(--title, light-dark(#1A1A1A,#FAFAFA))",cursor:h?"pointer":"default","data-value":o,fontWeight:i?"700":"400",gap:{checkbox:"10px",radio:"6px",default:"0"}[d],h:"40px",onClick:r?void 0:u=>k(o,u),px:"10px",styleOrder:1,transition:"background-color 0.1s ease-in-out",...g,children:[c&&{checkbox:e.jsx(a.Box,{bg:r?"var(--inputDisabledBackground, light-dark(#F0F0F3, #414244))":i?"var(--primary, light-dark(#674DC7, #8163E1)":"var(--border, light-dark(#E4E4E4, #434343))",borderRadius:"4px",boxSize:"18px",pos:"relative",transition:"background-color 0.1s ease-in-out",children:i&&e.jsx(j.IconCheck,{className:a.css({color:r?"var(--inputDisabledText, light-dark(#E5E5E5, #373737))":"#FFF",position:"absolute",top:"55%",left:"50%",transform:"translate(-50%, -50%)"})})}),radio:e.jsx(e.Fragment,{children:i&&e.jsx(a.Box,{borderRadius:"4px",boxSize:"18px",pos:"relative",transition:"background-color 0.1s ease-in-out",children:e.jsx(j.IconCheck,{className:a.css({position:"absolute",top:"55%",left:"50%",transform:"translate(-50%, -50%)",color:"inherit"})})})}),default:null}[d],f]})}function L({...r}){return e.jsx(a.Box,{bg:"var(--border, light-dark(#E4E4E4,#434343)",h:"1px",styleOrder:1,w:"100%",...r})}exports.Select=z;exports.SelectContainer=B;exports.SelectDivider=L;exports.SelectOption=D;exports.SelectTrigger=O;
|
|
1
|
+
"use client";"use client";const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../Button/index.cjs`),n=require(`../../contexts/useSelect.cjs`),r=require(`./IconCheck.cjs`);let i=require(`@devup-ui/react`),a=require(`react/jsx-runtime`),o=require(`react`),s=require(`clsx`);s=e.__toESM(s);function c({type:e=`default`,children:t,defaultValue:r,value:s,onChange:c,defaultOpen:f,open:p,onOpenChange:m,colors:h,typography:g,options:_,triggerProps:v,containerProps:y,optionProps:b,...x}){let S=(0,o.useRef)(null),[C,w]=(0,o.useState)(f??!1),[T,E]=(0,o.useState)(r??(e===`checkbox`?[]:``));return(0,o.useEffect)(()=>{let e=e=>{S.current&&S.current.contains(e.target)||w(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[C,w]),(0,a.jsx)(n.SelectContext.Provider,{value:{open:p??C,setOpen:e=>{m?.(e),w(e)},value:s??T,setValue:t=>{if(c?.(t),e!==`default`){if(e===`radio`){E(t);return}Array.isArray(T)&&T.includes(t)?E(T.filter(e=>e!==t)):E([...T,t])}},type:e,ref:S},children:(0,a.jsx)(i.Box,{ref:S,display:`inline-block`,h:`fit-content`,selectors:{"&, & *":{boxSizing:`border-box`}},styleOrder:1,styleVars:{primary:h?.primary,border:h?.border,inputBackground:h?.inputBackground,base10:h?.base10,title:h?.title,selectDisabled:h?.selectDisabled,primaryBg:h?.primaryBg,inputDisabledBackground:h?.inputDisabledBackground,inputDisabledText:h?.inputDisabledText},typography:g,...x,children:_?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l,{...v,children:t}),(0,a.jsx)(u,{...y,children:_?.map(e=>(0,o.createElement)(d,{...b,...e,key:`option-`+e.value},e.label??e.value))})]}):t})})}function l({className:e,children:r,asChild:c,...l}){let{open:u,setOpen:d}=n.useSelect(),f=()=>{d(!u)};if(c){let e=o.Children.only(r),t=e.type;return(0,a.jsx)(t,{"aria-expanded":u,"aria-label":`Select toggle`,onClick:f,...e.props})}return(0,a.jsx)(t.Button,{"aria-expanded":u,"aria-label":`Select toggle`,className:(0,s.default)((0,i.css)({borderRadius:`8px`,styleOrder:2}),e),onClick:f,...l,children:r})}function u({children:e,showConfirmButton:r,confirmButtonText:o=`완료`,x:s=0,y:c=0,...l}){let{open:u,setOpen:d,type:f,ref:p}=n.useSelect();return u?(0,a.jsxs)(i.VStack,{ref:e=>{if(!p.current||!e)return;let t=p.current,n=()=>{let{height:n,x:r,y:i,top:a,left:o}=t.getBoundingClientRect(),l=e.offsetHeight+a+window.scrollY+n+c>document.documentElement.scrollHeight,u=e.offsetWidth+o+window.scrollX+s>document.documentElement.scrollWidth;l?e.style.bottom=`${window.innerHeight-i+10}px`:e.style.top=`${i+n+10+c}px`,u?e.style.left=`${Math.max(r-e.offsetWidth+t.offsetWidth,0)+s}px`:e.style.left=`${r+s}px`};return n(),window.addEventListener(`scroll`,n,!0),window.addEventListener(`resize`,n),()=>{window.removeEventListener(`scroll`,n,!0),window.removeEventListener(`resize`,n)}},"aria-label":`Select container`,bg:`var(--inputBg, light-dark(#FFF,#2E2E2E))`,border:`1px solid var(--border, light-dark(#E4E4E4,#434343))`,borderRadius:`8px`,bottom:`-4px`,boxShadow:`0 2px 2px 0 var(--base10, light-dark(#0000001A,#FFFFFF1A))`,boxSize:`fit-content`,gap:`6px`,minW:`232px`,p:`10px`,pos:`fixed`,styleOrder:1,userSelect:`none`,zIndex:1,...l,children:[e,r&&f===`checkbox`&&(0,a.jsx)(i.Flex,{justifyContent:`end`,w:`100%`,children:(0,a.jsx)(t.Button,{"aria-label":`Select confirm button`,className:(0,i.css)({textAlign:`end`,bg:`var(--primary, light-dark(#674DC7, #8163E1))`,borderRadius:`8px`,w:`fit-content`,px:`30px`,py:`10px`,color:`#FFF`,typography:`buttonS`}),onClick:()=>d(!1),variant:`primary`,children:o})})]}):null}function d({disabled:e,onClick:t,children:o,value:s,showCheck:c=!0,...l}){let{setOpen:u,setValue:d,value:f,type:p}=n.useSelect(),m=()=>{p!==`checkbox`&&u(!1)},h=(e,n)=>{if(t){t(e,n);return}typeof e==`string`&&d(e),m()},g={default:!1,radio:f===s,checkbox:Array.isArray(f)&&s&&f.includes(s)}[p],_=!e&&!(p===`radio`&&g);return(0,a.jsxs)(i.Flex,{_hover:_&&{bg:`var(--primaryBg, light-dark(#F4F3FA, #F4F3FA0D))`},alignItems:`center`,"aria-label":`Select option`,borderRadius:`6px`,color:e?`var(--selectDisabled, light-dark(#C4C5D1, #45464D))`:g?`var(--primary, light-dark(#674DC7, #8163E1)`:`var(--title, light-dark(#1A1A1A,#FAFAFA))`,cursor:_?`pointer`:`default`,"data-value":s,fontWeight:g?`700`:`400`,gap:{checkbox:`10px`,radio:`6px`,default:`0`}[p],h:`40px`,onClick:e?void 0:e=>h(s,e),px:`10px`,styleOrder:1,transition:`background-color 0.1s ease-in-out`,...l,children:[c&&{checkbox:(0,a.jsx)(i.Box,{bg:e?`var(--inputDisabledBackground, light-dark(#F0F0F3, #414244))`:g?`var(--primary, light-dark(#674DC7, #8163E1)`:`var(--border, light-dark(#E4E4E4, #434343))`,borderRadius:`4px`,boxSize:`18px`,pos:`relative`,transition:`background-color 0.1s ease-in-out`,children:g&&(0,a.jsx)(r.IconCheck,{className:(0,i.css)({color:e?`var(--inputDisabledText, light-dark(#E5E5E5, #373737))`:`#FFF`,position:`absolute`,top:`55%`,left:`50%`,transform:`translate(-50%, -50%)`})})}),radio:(0,a.jsx)(a.Fragment,{children:g&&(0,a.jsx)(i.Box,{borderRadius:`4px`,boxSize:`18px`,pos:`relative`,transition:`background-color 0.1s ease-in-out`,children:(0,a.jsx)(r.IconCheck,{className:(0,i.css)({position:`absolute`,top:`55%`,left:`50%`,transform:`translate(-50%, -50%)`,color:`inherit`})})})}),default:null}[p],o]})}function f({...e}){return(0,a.jsx)(i.Box,{bg:`var(--border, light-dark(#E4E4E4,#434343)`,h:`1px`,styleOrder:1,w:`100%`,...e})}exports.Select=c,exports.SelectContainer=u,exports.SelectDivider=f,exports.SelectOption=d,exports.SelectTrigger=l;
|