@devup-ui/components 0.1.13 → 0.1.14
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),k=require("react"),c=require("@devup-ui/react"),A=require("clsx"),y=require("../../contexts/useSelect.cjs"),w=require("../Button/index.cjs"),j=require("./IconCheck.cjs");function O({type:n="default",children:u,defaultValue:g,value:s,onChange:l,defaultOpen:h,open:b,onOpenChange:o,colors:e,typography:x,options:a,...m}){const i=k.useRef(null),[f,d]=k.useState(h??!1),[p,v]=k.useState(g??(n==="checkbox"?[]:""));k.useEffect(()=>{const r=E=>{i.current&&i.current.contains(E.target)||d(!1)};return document.addEventListener("click",r),()=>document.removeEventListener("click",r)},[f,d]);const S=r=>{o==null||o(r),d(r)},F=r=>{if(l==null||l(r),n!=="default"){if(n==="radio"){v(r);return}Array.isArray(p)&&p.includes(r)?v(p.filter(E=>E!==r)):v([...p,r])}};return t.jsx(y.SelectContext.Provider,{value:{open:b??f,setOpen:S,value:s??p,setValue:F,type:n,ref:i},children:t.jsx(c.Box,{ref:i,display:"inline-block",h:"fit-content",selectors:{"&, & *":{boxSizing:"border-box"}},styleOrder:1,styleVars:{primary:e==null?void 0:e.primary,border:e==null?void 0:e.border,inputBackground:e==null?void 0:e.inputBackground,base10:e==null?void 0:e.base10,title:e==null?void 0:e.title,selectDisabled:e==null?void 0:e.selectDisabled,primaryBg:e==null?void 0:e.primaryBg,inputDisabledBackground:e==null?void 0:e.inputDisabledBackground,inputDisabledText:e==null?void 0:e.inputDisabledText},typography:x,...m,children:a?t.jsxs(t.Fragment,{children:[t.jsx(B,{children:u}),t.jsx(D,{children:a==null?void 0:a.map(r=>k.createElement(C,{...r,key:"option-"+r.value},r.label??r.value))})]}):u})})}function B({className:n,children:u,asChild:g,...s}){const{open:l,setOpen:h}=y.useSelect(),b=()=>{h(!l)};if(g){const o=k.Children.only(u),e=o.type;return t.jsx(e,{"aria-expanded":l,"aria-label":"Select toggle",onClick:b,...o.props})}return t.jsx(w.Button,{"aria-expanded":l,"aria-label":"Select toggle",className:A(c.css({borderRadius:"8px",styleOrder:2}),n),onClick:b,...s,children:u})}function D({children:n,showConfirmButton:u,confirmButtonText:g="완료",x:s=0,y:l=0,...h}){const{open:b,setOpen:o,type:e,ref:x}=y.useSelect();return b?t.jsxs(c.VStack,{ref:a=>{if(!x.current||!a)return;const m=x.current,i=()=>{const{height:f,x:d,y:p,top:v,left:S}=m.getBoundingClientRect(),F=a.offsetHeight+v+window.scrollY+f+l>document.documentElement.scrollHeight,r=a.offsetWidth+S+window.scrollX+s>document.documentElement.scrollWidth;F?a.style.bottom=`${window.innerHeight-p+10}px`:a.style.top=`${p+f+10+l}px`,r?a.style.left=`${Math.max(d-a.offsetWidth+m.offsetWidth,0)+s}px`:a.style.left=`${d+s}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,...h,children:[n,u&&e==="checkbox"&&t.jsx(c.Flex,{justifyContent:"end",w:"100%",children:t.jsx(w.Button,{"aria-label":"Select confirm button",className:c.css({textAlign:"end",bg:"var(--primary, light-dark(#674DC7, #8163E1))",borderRadius:"8px",w:"fit-content",px:"30px",py:"10px",color:"#FFF",typography:"buttonS"}),onClick:()=>o(!1),variant:"primary",children:g})})]}):null}function C({disabled:n,onClick:u,children:g,value:s,showCheck:l=!0,...h}){const{setOpen:b,setValue:o,value:e,type:x}=y.useSelect(),a=()=>{x!=="checkbox"&&b(!1)},m=(d,p)=>{if(u){u(d,p);return}typeof d=="string"&&o(d),a()},i={default:!1,radio:e===s,checkbox:Array.isArray(e)&&s&&e.includes(s)}[x],f=!n&&!(x==="radio"&&i);return t.jsxs(c.Flex,{_hover:f&&{bg:"var(--primaryBg, light-dark(#F4F3FA, #F4F3FA0D))"},alignItems:"center",borderRadius:"6px",color:n?"var(--selectDisabled, light-dark(#C4C5D1, #45464D))":i?"var(--primary, light-dark(#674DC7, #8163E1)":"var(--title, light-dark(#1A1A1A,#FAFAFA))",cursor:f?"pointer":"default","data-value":s,fontWeight:i?"700":"400",gap:{checkbox:"10px",radio:"6px",default:"0"}[x],h:"40px",onClick:n?void 0:d=>m(s,d),px:"10px",styleOrder:1,transition:"background-color 0.1s ease-in-out",...h,children:[l&&{checkbox:t.jsx(c.Box,{bg:n?"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&&t.jsx(j.IconCheck,{className:c.css({color:n?"var(--inputDisabledText, light-dark(#E5E5E5, #373737))":"#FFF",position:"absolute",top:"55%",left:"50%",transform:"translate(-50%, -50%)"})})}),radio:t.jsx(t.Fragment,{children:i&&t.jsx(c.Box,{borderRadius:"4px",boxSize:"18px",pos:"relative",transition:"background-color 0.1s ease-in-out",children:t.jsx(j.IconCheck,{className:c.css({position:"absolute",top:"55%",left:"50%",transform:"translate(-50%, -50%)",color:"inherit"})})})}),default:null}[x],g]})}function R({...n}){return t.jsx(c.Box,{bg:"var(--border, light-dark(#E4E4E4,#434343)",h:"1px",styleOrder:1,w:"100%",...n})}exports.Select=O;exports.SelectContainer=D;exports.SelectDivider=R;exports.SelectOption=C;exports.SelectTrigger=B;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Select/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,oBAAoB,EAAgB,MAAM,iBAAiB,CAAA;AAE9E,OAAO,EAEL,cAAc,EAOf,MAAM,OAAO,CAAA;AAGd,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAGlC,UAAU,WAAY,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IACnE,YAAY,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,CAAA;IACtC,KAAK,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,CAAA;IAC/B,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACtC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,MAAM,CAAC,EAAE;QACP,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,eAAe,CAAC,EAAE,MAAM,CAAA;QACxB,uBAAuB,CAAC,EAAE,MAAM,CAAA;QAChC,iBAAiB,CAAC,EAAE,MAAM,CAAA;QAC1B,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,cAAc,CAAC,EAAE,MAAM,CAAA;QACvB,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB,CAAA;IACD,UAAU,CAAC,EAAE,MAAM,oBAAoB,CA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YAAY,CAAC,EAC3B,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,KAAK,EACL,SAAgB,EAChB,GAAG,KAAK,EACT,EAAE,iBAAiB,2CAwHnB;AAED,wBAAgB,aAAa,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,2CAUhE"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as a, jsxs as
|
|
2
|
+
import { jsx as a, jsxs as S, Fragment as B } from "react/jsx-runtime";
|
|
3
3
|
import { useRef as R, useState as D, useEffect as z, createElement as L, Children as W } from "react";
|
|
4
|
-
import { Box as
|
|
4
|
+
import { Box as k, VStack as H, Flex as C, css as v } from "@devup-ui/react";
|
|
5
5
|
import N from "clsx";
|
|
6
|
-
import { SelectContext as T, useSelect as
|
|
6
|
+
import { SelectContext as T, useSelect as w } from "../../contexts/useSelect.js";
|
|
7
7
|
import { Button as O } from "../Button/index.js";
|
|
8
8
|
import { IconCheck as A } from "./IconCheck.js";
|
|
9
|
-
function
|
|
9
|
+
function G({
|
|
10
10
|
type: i = "default",
|
|
11
11
|
children: o,
|
|
12
|
-
defaultValue:
|
|
12
|
+
defaultValue: m,
|
|
13
13
|
value: d,
|
|
14
14
|
onChange: l,
|
|
15
|
-
defaultOpen:
|
|
15
|
+
defaultOpen: x,
|
|
16
16
|
open: f,
|
|
17
17
|
onOpenChange: c,
|
|
18
18
|
colors: e,
|
|
@@ -20,39 +20,39 @@ function J({
|
|
|
20
20
|
options: n,
|
|
21
21
|
...h
|
|
22
22
|
}) {
|
|
23
|
-
const r = R(null), [
|
|
24
|
-
|
|
23
|
+
const r = R(null), [b, s] = D(x ?? !1), [p, g] = D(
|
|
24
|
+
m ?? (i === "checkbox" ? [] : "")
|
|
25
25
|
);
|
|
26
26
|
z(() => {
|
|
27
|
-
const t = (
|
|
28
|
-
r.current && r.current.contains(
|
|
27
|
+
const t = (E) => {
|
|
28
|
+
r.current && r.current.contains(E.target) || s(!1);
|
|
29
29
|
};
|
|
30
30
|
return document.addEventListener("click", t), () => document.removeEventListener("click", t);
|
|
31
|
-
}, [
|
|
32
|
-
const
|
|
31
|
+
}, [b, s]);
|
|
32
|
+
const y = (t) => {
|
|
33
33
|
c == null || c(t), s(t);
|
|
34
|
-
},
|
|
34
|
+
}, F = (t) => {
|
|
35
35
|
if (l == null || l(t), i !== "default") {
|
|
36
36
|
if (i === "radio") {
|
|
37
37
|
g(t);
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
Array.isArray(p) && p.includes(t) ? g(p.filter((
|
|
40
|
+
Array.isArray(p) && p.includes(t) ? g(p.filter((E) => E !== t)) : g([...p, t]);
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
return /* @__PURE__ */ a(
|
|
44
44
|
T.Provider,
|
|
45
45
|
{
|
|
46
46
|
value: {
|
|
47
|
-
open: f ??
|
|
48
|
-
setOpen:
|
|
47
|
+
open: f ?? b,
|
|
48
|
+
setOpen: y,
|
|
49
49
|
value: d ?? p,
|
|
50
|
-
setValue:
|
|
50
|
+
setValue: F,
|
|
51
51
|
type: i,
|
|
52
52
|
ref: r
|
|
53
53
|
},
|
|
54
54
|
children: /* @__PURE__ */ a(
|
|
55
|
-
|
|
55
|
+
k,
|
|
56
56
|
{
|
|
57
57
|
ref: r,
|
|
58
58
|
display: "inline-block",
|
|
@@ -76,7 +76,7 @@ function J({
|
|
|
76
76
|
},
|
|
77
77
|
typography: u,
|
|
78
78
|
...h,
|
|
79
|
-
children: n ? /* @__PURE__ */
|
|
79
|
+
children: n ? /* @__PURE__ */ S(B, { children: [
|
|
80
80
|
/* @__PURE__ */ a($, { children: o }),
|
|
81
81
|
/* @__PURE__ */ a(j, { children: n == null ? void 0 : n.map((t) => /* @__PURE__ */ L(I, { ...t, key: "option-" + t.value }, t.label ?? t.value)) })
|
|
82
82
|
] }) : o
|
|
@@ -88,13 +88,13 @@ function J({
|
|
|
88
88
|
function $({
|
|
89
89
|
className: i,
|
|
90
90
|
children: o,
|
|
91
|
-
asChild:
|
|
91
|
+
asChild: m,
|
|
92
92
|
...d
|
|
93
93
|
}) {
|
|
94
|
-
const { open: l, setOpen:
|
|
95
|
-
|
|
94
|
+
const { open: l, setOpen: x } = w(), f = () => {
|
|
95
|
+
x(!l);
|
|
96
96
|
};
|
|
97
|
-
if (
|
|
97
|
+
if (m) {
|
|
98
98
|
const c = W.only(o), e = c.type;
|
|
99
99
|
return /* @__PURE__ */ a(
|
|
100
100
|
e,
|
|
@@ -112,7 +112,7 @@ function $({
|
|
|
112
112
|
"aria-expanded": l,
|
|
113
113
|
"aria-label": "Select toggle",
|
|
114
114
|
className: N(
|
|
115
|
-
|
|
115
|
+
v({
|
|
116
116
|
borderRadius: "8px",
|
|
117
117
|
styleOrder: 2
|
|
118
118
|
}),
|
|
@@ -127,27 +127,26 @@ function $({
|
|
|
127
127
|
function j({
|
|
128
128
|
children: i,
|
|
129
129
|
showConfirmButton: o,
|
|
130
|
-
confirmButtonText:
|
|
130
|
+
confirmButtonText: m = "완료",
|
|
131
131
|
x: d = 0,
|
|
132
132
|
y: l = 0,
|
|
133
|
-
...
|
|
133
|
+
...x
|
|
134
134
|
}) {
|
|
135
|
-
const { open: f, setOpen: c, type: e, ref: u } =
|
|
136
|
-
return f ? /* @__PURE__ */
|
|
135
|
+
const { open: f, setOpen: c, type: e, ref: u } = w();
|
|
136
|
+
return f ? /* @__PURE__ */ S(
|
|
137
137
|
H,
|
|
138
138
|
{
|
|
139
139
|
ref: (n) => {
|
|
140
140
|
if (!u.current || !n) return;
|
|
141
141
|
const h = u.current, r = () => {
|
|
142
142
|
const {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
t ? n.style.bottom = `${window.innerHeight - g + 10}px` : n.style.top = `${g + s + 10 + l}px`, k ? n.style.left = `${p - n.offsetWidth + h.offsetWidth + d}px` : n.style.left = `${p + d}px`;
|
|
143
|
+
height: b,
|
|
144
|
+
x: s,
|
|
145
|
+
y: p,
|
|
146
|
+
top: g,
|
|
147
|
+
left: y
|
|
148
|
+
} = h.getBoundingClientRect(), F = n.offsetHeight + g + window.scrollY + b + l > document.documentElement.scrollHeight, t = n.offsetWidth + y + window.scrollX + d > document.documentElement.scrollWidth;
|
|
149
|
+
F ? n.style.bottom = `${window.innerHeight - p + 10}px` : n.style.top = `${p + b + 10 + l}px`, t ? n.style.left = `${Math.max(s - n.offsetWidth + h.offsetWidth, 0) + d}px` : n.style.left = `${s + d}px`;
|
|
151
150
|
};
|
|
152
151
|
return r(), window.addEventListener("scroll", r, !0), window.addEventListener("resize", r), () => {
|
|
153
152
|
window.removeEventListener("scroll", r, !0), window.removeEventListener("resize", r);
|
|
@@ -167,14 +166,14 @@ function j({
|
|
|
167
166
|
styleOrder: 1,
|
|
168
167
|
userSelect: "none",
|
|
169
168
|
zIndex: 1,
|
|
170
|
-
...
|
|
169
|
+
...x,
|
|
171
170
|
children: [
|
|
172
171
|
i,
|
|
173
172
|
o && e === "checkbox" && /* @__PURE__ */ a(C, { justifyContent: "end", w: "100%", children: /* @__PURE__ */ a(
|
|
174
173
|
O,
|
|
175
174
|
{
|
|
176
175
|
"aria-label": "Select confirm button",
|
|
177
|
-
className:
|
|
176
|
+
className: v({
|
|
178
177
|
textAlign: "end",
|
|
179
178
|
bg: "var(--primary, light-dark(#674DC7, #8163E1))",
|
|
180
179
|
borderRadius: "8px",
|
|
@@ -186,7 +185,7 @@ function j({
|
|
|
186
185
|
}),
|
|
187
186
|
onClick: () => c(!1),
|
|
188
187
|
variant: "primary",
|
|
189
|
-
children:
|
|
188
|
+
children: m
|
|
190
189
|
}
|
|
191
190
|
) })
|
|
192
191
|
]
|
|
@@ -196,12 +195,12 @@ function j({
|
|
|
196
195
|
function I({
|
|
197
196
|
disabled: i,
|
|
198
197
|
onClick: o,
|
|
199
|
-
children:
|
|
198
|
+
children: m,
|
|
200
199
|
value: d,
|
|
201
200
|
showCheck: l = !0,
|
|
202
|
-
...
|
|
201
|
+
...x
|
|
203
202
|
}) {
|
|
204
|
-
const { setOpen: f, setValue: c, value: e, type: u } =
|
|
203
|
+
const { setOpen: f, setValue: c, value: e, type: u } = w(), n = () => {
|
|
205
204
|
u !== "checkbox" && f(!1);
|
|
206
205
|
}, h = (s, p) => {
|
|
207
206
|
if (o) {
|
|
@@ -213,17 +212,17 @@ function I({
|
|
|
213
212
|
default: !1,
|
|
214
213
|
radio: e === d,
|
|
215
214
|
checkbox: Array.isArray(e) && d && e.includes(d)
|
|
216
|
-
}[u],
|
|
217
|
-
return /* @__PURE__ */
|
|
215
|
+
}[u], b = !i && !(u === "radio" && r);
|
|
216
|
+
return /* @__PURE__ */ S(
|
|
218
217
|
C,
|
|
219
218
|
{
|
|
220
|
-
_hover:
|
|
219
|
+
_hover: b && {
|
|
221
220
|
bg: "var(--primaryBg, light-dark(#F4F3FA, #F4F3FA0D))"
|
|
222
221
|
},
|
|
223
222
|
alignItems: "center",
|
|
224
223
|
borderRadius: "6px",
|
|
225
224
|
color: i ? "var(--selectDisabled, light-dark(#C4C5D1, #45464D))" : r ? "var(--primary, light-dark(#674DC7, #8163E1)" : "var(--title, light-dark(#1A1A1A,#FAFAFA))",
|
|
226
|
-
cursor:
|
|
225
|
+
cursor: b ? "pointer" : "default",
|
|
227
226
|
"data-value": d,
|
|
228
227
|
fontWeight: r ? "700" : "400",
|
|
229
228
|
gap: {
|
|
@@ -236,11 +235,11 @@ function I({
|
|
|
236
235
|
px: "10px",
|
|
237
236
|
styleOrder: 1,
|
|
238
237
|
transition: "background-color 0.1s ease-in-out",
|
|
239
|
-
...
|
|
238
|
+
...x,
|
|
240
239
|
children: [
|
|
241
240
|
l && {
|
|
242
241
|
checkbox: /* @__PURE__ */ a(
|
|
243
|
-
|
|
242
|
+
k,
|
|
244
243
|
{
|
|
245
244
|
bg: i ? "var(--inputDisabledBackground, light-dark(#F0F0F3, #414244))" : r ? "var(--primary, light-dark(#674DC7, #8163E1)" : "var(--border, light-dark(#E4E4E4, #434343))",
|
|
246
245
|
borderRadius: "4px",
|
|
@@ -250,7 +249,7 @@ function I({
|
|
|
250
249
|
children: r && /* @__PURE__ */ a(
|
|
251
250
|
A,
|
|
252
251
|
{
|
|
253
|
-
className:
|
|
252
|
+
className: v({
|
|
254
253
|
color: i ? "var(--inputDisabledText, light-dark(#E5E5E5, #373737))" : "#FFF",
|
|
255
254
|
position: "absolute",
|
|
256
255
|
top: "55%",
|
|
@@ -262,7 +261,7 @@ function I({
|
|
|
262
261
|
}
|
|
263
262
|
),
|
|
264
263
|
radio: /* @__PURE__ */ a(B, { children: r && /* @__PURE__ */ a(
|
|
265
|
-
|
|
264
|
+
k,
|
|
266
265
|
{
|
|
267
266
|
borderRadius: "4px",
|
|
268
267
|
boxSize: "18px",
|
|
@@ -271,7 +270,7 @@ function I({
|
|
|
271
270
|
children: /* @__PURE__ */ a(
|
|
272
271
|
A,
|
|
273
272
|
{
|
|
274
|
-
className:
|
|
273
|
+
className: v({
|
|
275
274
|
position: "absolute",
|
|
276
275
|
top: "55%",
|
|
277
276
|
left: "50%",
|
|
@@ -284,14 +283,14 @@ function I({
|
|
|
284
283
|
) }),
|
|
285
284
|
default: null
|
|
286
285
|
}[u],
|
|
287
|
-
|
|
286
|
+
m
|
|
288
287
|
]
|
|
289
288
|
}
|
|
290
289
|
);
|
|
291
290
|
}
|
|
292
|
-
function
|
|
291
|
+
function J({ ...i }) {
|
|
293
292
|
return /* @__PURE__ */ a(
|
|
294
|
-
|
|
293
|
+
k,
|
|
295
294
|
{
|
|
296
295
|
bg: "var(--border, light-dark(#E4E4E4,#434343)",
|
|
297
296
|
h: "1px",
|
|
@@ -302,9 +301,9 @@ function K({ ...i }) {
|
|
|
302
301
|
);
|
|
303
302
|
}
|
|
304
303
|
export {
|
|
305
|
-
|
|
304
|
+
G as Select,
|
|
306
305
|
j as SelectContainer,
|
|
307
|
-
|
|
306
|
+
J as SelectDivider,
|
|
308
307
|
I as SelectOption,
|
|
309
308
|
$ as SelectTrigger
|
|
310
309
|
};
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"css-in-js-framework",
|
|
17
17
|
"react"
|
|
18
18
|
],
|
|
19
|
-
"version": "0.1.
|
|
19
|
+
"version": "0.1.14",
|
|
20
20
|
"type": "module",
|
|
21
21
|
"publishConfig": {
|
|
22
22
|
"access": "public"
|
|
@@ -41,18 +41,18 @@
|
|
|
41
41
|
"@devup-ui/react": "1.0.17"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@storybook/addon-docs": "^9.1.
|
|
45
|
-
"@storybook/addon-onboarding": "^9.1.
|
|
46
|
-
"@storybook/react-vite": "^9.1.
|
|
44
|
+
"@storybook/addon-docs": "^9.1.4",
|
|
45
|
+
"@storybook/addon-onboarding": "^9.1.4",
|
|
46
|
+
"@storybook/react-vite": "^9.1.4",
|
|
47
47
|
"@types/react": "^19.1.12",
|
|
48
|
-
"eslint-plugin-storybook": "^9.1.
|
|
48
|
+
"eslint-plugin-storybook": "^9.1.4",
|
|
49
49
|
"rollup-plugin-preserve-directives": "^0.4.0",
|
|
50
|
-
"storybook": "^9.1.
|
|
50
|
+
"storybook": "^9.1.4",
|
|
51
51
|
"typescript": "^5.9.2",
|
|
52
|
-
"vite": "^7.1.
|
|
52
|
+
"vite": "^7.1.4",
|
|
53
53
|
"vite-plugin-dts": "^4.5.4",
|
|
54
54
|
"vitest": "^3.2.4",
|
|
55
|
-
"@devup-ui/vite-plugin": "1.0.
|
|
55
|
+
"@devup-ui/vite-plugin": "1.0.34"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"csstype": "*",
|