@devup-ui/components 0.1.5 → 0.1.7
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/components/Input/index.cjs +1 -1
- package/dist/components/Input/index.js +18 -18
- package/dist/components/Select/IconCheck.cjs +1 -0
- package/dist/components/Select/IconCheck.d.ts.map +1 -1
- package/dist/components/Select/IconCheck.js +26 -0
- package/dist/components/Select/index.cjs +2 -0
- package/dist/components/Select/index.d.ts +4 -1
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +291 -0
- package/dist/components/Stepper/IconMinus.cjs +1 -0
- package/dist/components/Stepper/IconMinus.js +26 -0
- package/dist/components/Stepper/IconPlus.cjs +1 -0
- package/dist/components/Stepper/IconPlus.js +24 -0
- package/dist/components/Stepper/index.cjs +1 -1
- package/dist/components/Stepper/index.d.ts +4 -2
- package/dist/components/Stepper/index.d.ts.map +1 -1
- package/dist/components/Stepper/index.js +137 -22
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -6
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("@devup-ui/react"),C=require("react");function S({defaultValue:n,value:
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("@devup-ui/react"),C=require("react");function S({defaultValue:n,value:F,onChange:a,typography:o,error:b=!1,errorMessage:x,allowClear:g=!0,icon:d,colors:t,disabled:u,className:B,classNames:r,ref:y,onClear:p,...D}){const[h,l]=C.useState(n||""),E=v=>{l(v.target.value),a==null||a(v)},j=()=>{l(""),p==null||p()},f=h&&!u&&g;return e.jsxs(i.Box,{className:r==null?void 0:r.container,display:"inline-block",pos:"relative",selectors:{"&, & *":{boxSizing:"border-box"}},children:[d&&e.jsx(i.Center,{"aria-label":"icon",boxSize:"24px",className:r==null?void 0:r.icon,color:u?"var(--inputDisabledText, light-dark(#D6D7DE, #373737))":"var(--iconBold, light-dark(#8D8C9A, #666577))",left:"12px",pos:"absolute",styleOrder:1,top:"50%",transform:"translateY(-50%)",children:d}),e.jsx(i.Input,{ref:y,_disabled:{_placeholder:{color:"var(--inputDisabledText, light-dark(#D6D7DE, #373737))"},bg:"var(--inputDisabledBg, light-dark(#F0F0F3, #414244))",border:"1px solid var(--border, light-dark(#E4E4E4, #434343))",color:"var(--inputDisabledText, light-dark(#D6D7DE, #373737))"},_focus:{bg:"var(--primaryBg, light-dark(#F4F3FA, #F4F3FA0D))",border:"1px solid var(--primary, light-dark(#674DC7, #8163E1))",outline:"none"},_hover:{border:"1px solid var(--primary, light-dark(#674DC7, #8163E1))"},_placeholder:{color:"var(--inputPlaceholder, light-dark(#A9A8AB, #CBCBCB))"},"aria-label":"input",bg:"var(--inputBg, light-dark(#FFFFFF, #2E2E2E))",borderColor:b?"var(--error, light-dark(#D52B2E, #FF5B5E))":"var(--border, light-dark(#E4E4E4, #434343))",borderRadius:"8px",borderStyle:"solid",borderWidth:"1px",className:`${B||""} ${(r==null?void 0:r.input)||""}`.trim(),disabled:u,onChange:E,pl:d?"36px":"12px",pr:g?"36px":"12px",py:"12px",styleOrder:1,styleVars:{primary:t==null?void 0:t.primary,error:t==null?void 0:t.error,text:t==null?void 0:t.text,base:t==null?void 0:t.base,iconBold:t==null?void 0:t.iconBold,border:t==null?void 0:t.border,inputBackground:t==null?void 0:t.inputBackground,primaryFocus:t==null?void 0:t.primaryFocus,negative20:t==null?void 0:t.negative20},transition:"all 0.1s ease-in-out",typography:o,value:F??h,...D}),f&&e.jsx(k,{onClick:j}),b&&x&&e.jsx(i.Text,{"aria-label":"error-message",bottom:"-8px",className:r==null?void 0:r.errorMessage,color:"var(--error, light-dark(#D52B2E, #FF5B5E))",left:"0",pos:"absolute",styleOrder:1,transform:"translateY(100%)",typography:"inputPlaceholder",children:x})]})}function k(n){return e.jsx(i.Button,{alignItems:"center","aria-label":"clear-button",bg:"var(--negative20, light-dark(#0003, #FFF6))",border:"none",borderRadius:"50%",boxSize:"20px",color:"var(--base, light-dark(#FFF, #000))",cursor:"pointer",display:"flex",justifyContent:"center",p:"2px",pos:"absolute",right:"12px",styleOrder:1,top:"50%",transform:"translateY(-50%)",...n,children:e.jsxs("svg",{fill:"none",height:"24",viewBox:"0 0 24 24",width:"24",xmlns:"http://www.w3.org/2000/svg",children:[e.jsx("path",{d:"M18 6L6 18",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"}),e.jsx("path",{d:"M6 6L18 18",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})]})})}exports.ClearButton=k;exports.Input=S;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
2
|
+
import { jsxs as k, jsx as e } from "react/jsx-runtime";
|
|
3
3
|
import { Box as C, Center as m, Input as A, Text as L, Button as j } from "@devup-ui/react";
|
|
4
4
|
import { useState as w } from "react";
|
|
5
5
|
function T({
|
|
6
6
|
defaultValue: i,
|
|
7
|
-
value:
|
|
7
|
+
value: v,
|
|
8
8
|
onChange: n,
|
|
9
|
-
typography:
|
|
10
|
-
error:
|
|
11
|
-
errorMessage:
|
|
12
|
-
allowClear:
|
|
9
|
+
typography: F,
|
|
10
|
+
error: u = !1,
|
|
11
|
+
errorMessage: b,
|
|
12
|
+
allowClear: h = !0,
|
|
13
13
|
icon: a,
|
|
14
14
|
colors: t,
|
|
15
15
|
disabled: d,
|
|
@@ -19,12 +19,12 @@ function T({
|
|
|
19
19
|
onClear: p,
|
|
20
20
|
...y
|
|
21
21
|
}) {
|
|
22
|
-
const [
|
|
23
|
-
|
|
22
|
+
const [g, l] = w(i || ""), D = (x) => {
|
|
23
|
+
l(x.target.value), n == null || n(x);
|
|
24
24
|
}, E = () => {
|
|
25
|
-
|
|
26
|
-
}, f =
|
|
27
|
-
return /* @__PURE__ */
|
|
25
|
+
l(""), p == null || p();
|
|
26
|
+
}, f = g && !d && h;
|
|
27
|
+
return /* @__PURE__ */ k(
|
|
28
28
|
C,
|
|
29
29
|
{
|
|
30
30
|
className: r == null ? void 0 : r.container,
|
|
@@ -72,7 +72,7 @@ function T({
|
|
|
72
72
|
},
|
|
73
73
|
"aria-label": "input",
|
|
74
74
|
bg: "var(--inputBg, light-dark(#FFFFFF, #2E2E2E))",
|
|
75
|
-
borderColor:
|
|
75
|
+
borderColor: u ? "var(--error, light-dark(#D52B2E, #FF5B5E))" : "var(--border, light-dark(#E4E4E4, #434343))",
|
|
76
76
|
borderRadius: "8px",
|
|
77
77
|
borderStyle: "solid",
|
|
78
78
|
borderWidth: "1px",
|
|
@@ -80,7 +80,7 @@ function T({
|
|
|
80
80
|
disabled: d,
|
|
81
81
|
onChange: D,
|
|
82
82
|
pl: a ? "36px" : "12px",
|
|
83
|
-
pr:
|
|
83
|
+
pr: h ? "36px" : "12px",
|
|
84
84
|
py: "12px",
|
|
85
85
|
styleOrder: 1,
|
|
86
86
|
styleVars: {
|
|
@@ -95,13 +95,13 @@ function T({
|
|
|
95
95
|
negative20: t == null ? void 0 : t.negative20
|
|
96
96
|
},
|
|
97
97
|
transition: "all 0.1s ease-in-out",
|
|
98
|
-
typography:
|
|
99
|
-
value:
|
|
98
|
+
typography: F,
|
|
99
|
+
value: v ?? g,
|
|
100
100
|
...y
|
|
101
101
|
}
|
|
102
102
|
),
|
|
103
103
|
f && /* @__PURE__ */ e(S, { onClick: E }),
|
|
104
|
-
u && /* @__PURE__ */ e(
|
|
104
|
+
u && b && /* @__PURE__ */ e(
|
|
105
105
|
L,
|
|
106
106
|
{
|
|
107
107
|
"aria-label": "error-message",
|
|
@@ -113,7 +113,7 @@ function T({
|
|
|
113
113
|
styleOrder: 1,
|
|
114
114
|
transform: "translateY(100%)",
|
|
115
115
|
typography: "inputPlaceholder",
|
|
116
|
-
children:
|
|
116
|
+
children: b
|
|
117
117
|
}
|
|
118
118
|
)
|
|
119
119
|
]
|
|
@@ -141,7 +141,7 @@ function S(i) {
|
|
|
141
141
|
top: "50%",
|
|
142
142
|
transform: "translateY(-50%)",
|
|
143
143
|
...i,
|
|
144
|
-
children: /* @__PURE__ */
|
|
144
|
+
children: /* @__PURE__ */ k(
|
|
145
145
|
"svg",
|
|
146
146
|
{
|
|
147
147
|
fill: "none",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime");function t({...n}){return e.jsx("svg",{fill:"none",height:"10",viewBox:"0 0 12 10",width:"12",xmlns:"http://www.w3.org/2000/svg",...n,children: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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconCheck.d.ts","sourceRoot":"","sources":["../../../src/components/Select/IconCheck.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAEtC,wBAAgB,SAAS,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"IconCheck.d.ts","sourceRoot":"","sources":["../../../src/components/Select/IconCheck.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAEtC,wBAAgB,SAAS,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,2CAkB5D"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
function n({ ...l }) {
|
|
3
|
+
return /* @__PURE__ */ e(
|
|
4
|
+
"svg",
|
|
5
|
+
{
|
|
6
|
+
fill: "none",
|
|
7
|
+
height: "10",
|
|
8
|
+
viewBox: "0 0 12 10",
|
|
9
|
+
width: "12",
|
|
10
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11
|
+
...l,
|
|
12
|
+
children: /* @__PURE__ */ e(
|
|
13
|
+
"path",
|
|
14
|
+
{
|
|
15
|
+
clipRule: "evenodd",
|
|
16
|
+
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",
|
|
17
|
+
fill: "currentColor",
|
|
18
|
+
fillRule: "evenodd"
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
n as IconCheck
|
|
26
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),d=require("@devup-ui/react"),D=require("clsx"),g=require("react"),y=require("../Button/index.cjs"),v=require("./IconCheck.cjs"),E=g.createContext(null),S=()=>{const t=g.useContext(E);if(!t)throw new Error("useSelect must be used within a Select");return t};function A({type:t="default",children:l,defaultValue:o,value:i,onValueChange:n,defaultOpen:x,open:u,onOpenChange:p,colors:e,typography:b,...F}){const h=g.useRef(null),[c,f]=g.useState(x??!1),[a,k]=g.useState(o??(t==="checkbox"?[]:""));g.useEffect(()=>{const s=m=>{h.current&&h.current.contains(m.target)||f(!1)};return document.addEventListener("click",s),()=>document.removeEventListener("click",s)},[c,f]);const j=s=>{p==null||p(s),f(s)},C=s=>{if(n==null||n(s),t!=="default"){if(t==="radio"){k(s);return}Array.isArray(a)&&a.includes(s)?k(a.filter(m=>m!==s)):k([...a,s])}};return r.jsx(E.Provider,{value:{open:u??c,setOpen:j,value:i??a,setValue:C,type:t},children:r.jsx(d.Box,{ref:h,display:"inline-block",pos:"relative",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:b,...F,children:l})})}function B({className:t,children:l,asChild:o,...i}){const{open:n,setOpen:x}=S(),u=()=>{x(!n)};if(o){const p=g.Children.only(l),e=p.type;return r.jsx(e,{"aria-expanded":n,"aria-label":"Select toggle",onClick:u,...p.props})}return r.jsx(y.Button,{"aria-expanded":n,"aria-label":"Select toggle",className:D(d.css({borderRadius:"8px"}),t),onClick:u,...i,children:l})}function O({children:t,showConfirmButton:l,confirmButtonText:o="완료",...i}){const{open:n,setOpen:x,type:u}=S();return n?r.jsxs(d.VStack,{"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))",gap:"6px",h:"fit-content",p:"10px",pos:"absolute",styleOrder:1,transform:"translateY(100%)",userSelect:"none",w:"232px",...i,children:[t,l&&u==="checkbox"&&r.jsx(d.Flex,{justifyContent:"end",w:"100%",children:r.jsx(y.Button,{"aria-label":"Select confirm button",className:d.css({textAlign:"end",bg:"var(--primary, light-dark(#674DC7, #8163E1))",borderRadius:"8px",w:"fit-content",px:"30px",py:"10px",color:"#FFF",typography:"buttonS"}),onClick:()=>x(!1),variant:"primary",children:o})})]}):null}function w({disabled:t,onClick:l,children:o,value:i,showCheck:n=!0,...x}){const{setOpen:u,setValue:p,value:e,type:b}=S(),F=()=>{b!=="checkbox"&&u(!1)},h=(a,k)=>{if(l){l(a,k);return}typeof a=="string"&&p(a),F()},c={default:!1,radio:e===i,checkbox:Array.isArray(e)&&i&&e.includes(i)}[b],f=!t&&!(b==="radio"&&c);return r.jsxs(d.Flex,{_hover:f&&{bg:"var(--primaryBg, light-dark(#F4F3FA, #F4F3FA0D))"},alignItems:"center",borderRadius:"6px",color:t?"var(--selectDisabled, light-dark(#C4C5D1, #45464D))":c?"var(--primary, light-dark(#674DC7, #8163E1)":"var(--title, light-dark(#1A1A1A,#FAFAFA))",cursor:f?"pointer":"default","data-value":i,fontWeight:c?"700":"400",gap:{checkbox:"10px",radio:"6px",default:"0"}[b],h:"40px",onClick:t?void 0:a=>h(i,a),px:"10px",styleOrder:1,transition:"background-color 0.1s ease-in-out",...x,children:[n&&{checkbox:r.jsx(d.Box,{bg:t?"var(--inputDisabledBackground, light-dark(#F0F0F3, #414244))":c?"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:c&&r.jsx(v.IconCheck,{className:d.css({color:t?"var(--inputDisabledText, light-dark(#E5E5E5, #373737))":"#FFF",position:"absolute",top:"55%",left:"50%",transform:"translate(-50%, -50%)"})})}),radio:r.jsx(r.Fragment,{children:c&&r.jsx(d.Box,{borderRadius:"4px",boxSize:"18px",pos:"relative",transition:"background-color 0.1s ease-in-out",children:r.jsx(v.IconCheck,{className:d.css({position:"absolute",top:"55%",left:"50%",transform:"translate(-50%, -50%)",color:"inherit"})})})}),default:null}[b],o]})}function R({...t}){return r.jsx(d.Box,{bg:"var(--border, light-dark(#E4E4E4,#434343)",h:"1px",styleOrder:1,w:"100%",...t})}exports.Select=A;exports.SelectContainer=O;exports.SelectDivider=R;exports.SelectOption=w;exports.SelectTrigger=B;exports.useSelect=S;
|
|
@@ -23,6 +23,8 @@ interface SelectProps extends ComponentProps<'div'> {
|
|
|
23
23
|
primary?: string;
|
|
24
24
|
border?: string;
|
|
25
25
|
inputBackground?: string;
|
|
26
|
+
inputDisabledBackground?: string;
|
|
27
|
+
inputDisabledText?: string;
|
|
26
28
|
base10?: string;
|
|
27
29
|
title?: string;
|
|
28
30
|
selectDisabled?: string;
|
|
@@ -37,8 +39,9 @@ interface SelectTriggerProps extends ComponentProps<typeof Button> {
|
|
|
37
39
|
export declare function SelectTrigger({ className, children, asChild, ...props }: SelectTriggerProps): import("react/jsx-runtime").JSX.Element;
|
|
38
40
|
interface SelectContainerProps extends ComponentProps<'div'> {
|
|
39
41
|
showConfirmButton?: boolean;
|
|
42
|
+
confirmButtonText?: string;
|
|
40
43
|
}
|
|
41
|
-
export declare function SelectContainer({ children, showConfirmButton, ...props }: SelectContainerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
44
|
+
export declare function SelectContainer({ children, showConfirmButton, confirmButtonText, ...props }: SelectContainerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
42
45
|
interface SelectOptionProps extends Omit<ComponentProps<'div'>, 'onClick'> {
|
|
43
46
|
onClick?: (value: string | undefined, e?: React.MouseEvent<HTMLDivElement>) => void;
|
|
44
47
|
disabled?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Select/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,oBAAoB,EAAgB,M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AC,UAAU,CAAC,cAAc,CAAC,KACjC,IAAI,CAAA;IACT,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,wBAAgB,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"}
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as r, jsxs as S, Fragment as w } from "react/jsx-runtime";
|
|
3
|
+
import { Box as h, VStack as R, Flex as D, css as k } from "@devup-ui/react";
|
|
4
|
+
import N from "clsx";
|
|
5
|
+
import { useRef as T, useState as y, useEffect as j, createContext as z, Children as I, useContext as L } from "react";
|
|
6
|
+
import { Button as A } from "../Button/index.js";
|
|
7
|
+
import { IconCheck as E } from "./IconCheck.js";
|
|
8
|
+
const C = z(null), v = () => {
|
|
9
|
+
const t = L(C);
|
|
10
|
+
if (!t)
|
|
11
|
+
throw new Error("useSelect must be used within a Select");
|
|
12
|
+
return t;
|
|
13
|
+
};
|
|
14
|
+
function G({
|
|
15
|
+
type: t = "default",
|
|
16
|
+
children: l,
|
|
17
|
+
defaultValue: c,
|
|
18
|
+
value: i,
|
|
19
|
+
onValueChange: a,
|
|
20
|
+
defaultOpen: o,
|
|
21
|
+
open: p,
|
|
22
|
+
onOpenChange: u,
|
|
23
|
+
colors: e,
|
|
24
|
+
typography: b,
|
|
25
|
+
...m
|
|
26
|
+
}) {
|
|
27
|
+
const x = T(null), [s, f] = y(o ?? !1), [n, g] = y(
|
|
28
|
+
c ?? (t === "checkbox" ? [] : "")
|
|
29
|
+
);
|
|
30
|
+
j(() => {
|
|
31
|
+
const d = (F) => {
|
|
32
|
+
x.current && x.current.contains(F.target) || f(!1);
|
|
33
|
+
};
|
|
34
|
+
return document.addEventListener("click", d), () => document.removeEventListener("click", d);
|
|
35
|
+
}, [s, f]);
|
|
36
|
+
const B = (d) => {
|
|
37
|
+
u == null || u(d), f(d);
|
|
38
|
+
}, O = (d) => {
|
|
39
|
+
if (a == null || a(d), t !== "default") {
|
|
40
|
+
if (t === "radio") {
|
|
41
|
+
g(d);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
Array.isArray(n) && n.includes(d) ? g(n.filter((F) => F !== d)) : g([...n, d]);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
return /* @__PURE__ */ r(
|
|
48
|
+
C.Provider,
|
|
49
|
+
{
|
|
50
|
+
value: {
|
|
51
|
+
open: p ?? s,
|
|
52
|
+
setOpen: B,
|
|
53
|
+
value: i ?? n,
|
|
54
|
+
setValue: O,
|
|
55
|
+
type: t
|
|
56
|
+
},
|
|
57
|
+
children: /* @__PURE__ */ r(
|
|
58
|
+
h,
|
|
59
|
+
{
|
|
60
|
+
ref: x,
|
|
61
|
+
display: "inline-block",
|
|
62
|
+
pos: "relative",
|
|
63
|
+
selectors: {
|
|
64
|
+
"&, & *": {
|
|
65
|
+
boxSizing: "border-box"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
styleOrder: 1,
|
|
69
|
+
styleVars: {
|
|
70
|
+
primary: e == null ? void 0 : e.primary,
|
|
71
|
+
border: e == null ? void 0 : e.border,
|
|
72
|
+
inputBackground: e == null ? void 0 : e.inputBackground,
|
|
73
|
+
base10: e == null ? void 0 : e.base10,
|
|
74
|
+
title: e == null ? void 0 : e.title,
|
|
75
|
+
selectDisabled: e == null ? void 0 : e.selectDisabled,
|
|
76
|
+
primaryBg: e == null ? void 0 : e.primaryBg,
|
|
77
|
+
inputDisabledBackground: e == null ? void 0 : e.inputDisabledBackground,
|
|
78
|
+
inputDisabledText: e == null ? void 0 : e.inputDisabledText
|
|
79
|
+
},
|
|
80
|
+
typography: b,
|
|
81
|
+
...m,
|
|
82
|
+
children: l
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
function J({
|
|
89
|
+
className: t,
|
|
90
|
+
children: l,
|
|
91
|
+
asChild: c,
|
|
92
|
+
...i
|
|
93
|
+
}) {
|
|
94
|
+
const { open: a, setOpen: o } = v(), p = () => {
|
|
95
|
+
o(!a);
|
|
96
|
+
};
|
|
97
|
+
if (c) {
|
|
98
|
+
const u = I.only(l), e = u.type;
|
|
99
|
+
return /* @__PURE__ */ r(
|
|
100
|
+
e,
|
|
101
|
+
{
|
|
102
|
+
"aria-expanded": a,
|
|
103
|
+
"aria-label": "Select toggle",
|
|
104
|
+
onClick: p,
|
|
105
|
+
...u.props
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
return /* @__PURE__ */ r(
|
|
110
|
+
A,
|
|
111
|
+
{
|
|
112
|
+
"aria-expanded": a,
|
|
113
|
+
"aria-label": "Select toggle",
|
|
114
|
+
className: N(
|
|
115
|
+
k({
|
|
116
|
+
borderRadius: "8px"
|
|
117
|
+
}),
|
|
118
|
+
t
|
|
119
|
+
),
|
|
120
|
+
onClick: p,
|
|
121
|
+
...i,
|
|
122
|
+
children: l
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
function K({
|
|
127
|
+
children: t,
|
|
128
|
+
showConfirmButton: l,
|
|
129
|
+
confirmButtonText: c = "완료",
|
|
130
|
+
...i
|
|
131
|
+
}) {
|
|
132
|
+
const { open: a, setOpen: o, type: p } = v();
|
|
133
|
+
return a ? /* @__PURE__ */ S(
|
|
134
|
+
R,
|
|
135
|
+
{
|
|
136
|
+
"aria-label": "Select container",
|
|
137
|
+
bg: "var(--inputBg, light-dark(#FFF,#2E2E2E))",
|
|
138
|
+
border: "1px solid var(--border, light-dark(#E4E4E4,#434343))",
|
|
139
|
+
borderRadius: "8px",
|
|
140
|
+
bottom: "-4px",
|
|
141
|
+
boxShadow: "0 2px 2px 0 var(--base10, light-dark(#0000001A,#FFFFFF1A))",
|
|
142
|
+
gap: "6px",
|
|
143
|
+
h: "fit-content",
|
|
144
|
+
p: "10px",
|
|
145
|
+
pos: "absolute",
|
|
146
|
+
styleOrder: 1,
|
|
147
|
+
transform: "translateY(100%)",
|
|
148
|
+
userSelect: "none",
|
|
149
|
+
w: "232px",
|
|
150
|
+
...i,
|
|
151
|
+
children: [
|
|
152
|
+
t,
|
|
153
|
+
l && p === "checkbox" && /* @__PURE__ */ r(D, { justifyContent: "end", w: "100%", children: /* @__PURE__ */ r(
|
|
154
|
+
A,
|
|
155
|
+
{
|
|
156
|
+
"aria-label": "Select confirm button",
|
|
157
|
+
className: k({
|
|
158
|
+
textAlign: "end",
|
|
159
|
+
bg: "var(--primary, light-dark(#674DC7, #8163E1))",
|
|
160
|
+
borderRadius: "8px",
|
|
161
|
+
w: "fit-content",
|
|
162
|
+
px: "30px",
|
|
163
|
+
py: "10px",
|
|
164
|
+
color: "#FFF",
|
|
165
|
+
typography: "buttonS"
|
|
166
|
+
}),
|
|
167
|
+
onClick: () => o(!1),
|
|
168
|
+
variant: "primary",
|
|
169
|
+
children: c
|
|
170
|
+
}
|
|
171
|
+
) })
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
) : null;
|
|
175
|
+
}
|
|
176
|
+
function M({
|
|
177
|
+
disabled: t,
|
|
178
|
+
onClick: l,
|
|
179
|
+
children: c,
|
|
180
|
+
value: i,
|
|
181
|
+
showCheck: a = !0,
|
|
182
|
+
...o
|
|
183
|
+
}) {
|
|
184
|
+
const { setOpen: p, setValue: u, value: e, type: b } = v(), m = () => {
|
|
185
|
+
b !== "checkbox" && p(!1);
|
|
186
|
+
}, x = (n, g) => {
|
|
187
|
+
if (l) {
|
|
188
|
+
l(n, g);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
typeof n == "string" && u(n), m();
|
|
192
|
+
}, s = {
|
|
193
|
+
default: !1,
|
|
194
|
+
radio: e === i,
|
|
195
|
+
checkbox: Array.isArray(e) && i && e.includes(i)
|
|
196
|
+
}[b], f = !t && !(b === "radio" && s);
|
|
197
|
+
return /* @__PURE__ */ S(
|
|
198
|
+
D,
|
|
199
|
+
{
|
|
200
|
+
_hover: f && {
|
|
201
|
+
bg: "var(--primaryBg, light-dark(#F4F3FA, #F4F3FA0D))"
|
|
202
|
+
},
|
|
203
|
+
alignItems: "center",
|
|
204
|
+
borderRadius: "6px",
|
|
205
|
+
color: t ? "var(--selectDisabled, light-dark(#C4C5D1, #45464D))" : s ? "var(--primary, light-dark(#674DC7, #8163E1)" : "var(--title, light-dark(#1A1A1A,#FAFAFA))",
|
|
206
|
+
cursor: f ? "pointer" : "default",
|
|
207
|
+
"data-value": i,
|
|
208
|
+
fontWeight: s ? "700" : "400",
|
|
209
|
+
gap: {
|
|
210
|
+
checkbox: "10px",
|
|
211
|
+
radio: "6px",
|
|
212
|
+
default: "0"
|
|
213
|
+
}[b],
|
|
214
|
+
h: "40px",
|
|
215
|
+
onClick: t ? void 0 : (n) => x(i, n),
|
|
216
|
+
px: "10px",
|
|
217
|
+
styleOrder: 1,
|
|
218
|
+
transition: "background-color 0.1s ease-in-out",
|
|
219
|
+
...o,
|
|
220
|
+
children: [
|
|
221
|
+
a && {
|
|
222
|
+
checkbox: /* @__PURE__ */ r(
|
|
223
|
+
h,
|
|
224
|
+
{
|
|
225
|
+
bg: t ? "var(--inputDisabledBackground, light-dark(#F0F0F3, #414244))" : s ? "var(--primary, light-dark(#674DC7, #8163E1)" : "var(--border, light-dark(#E4E4E4, #434343))",
|
|
226
|
+
borderRadius: "4px",
|
|
227
|
+
boxSize: "18px",
|
|
228
|
+
pos: "relative",
|
|
229
|
+
transition: "background-color 0.1s ease-in-out",
|
|
230
|
+
children: s && /* @__PURE__ */ r(
|
|
231
|
+
E,
|
|
232
|
+
{
|
|
233
|
+
className: k({
|
|
234
|
+
color: t ? "var(--inputDisabledText, light-dark(#E5E5E5, #373737))" : "#FFF",
|
|
235
|
+
position: "absolute",
|
|
236
|
+
top: "55%",
|
|
237
|
+
left: "50%",
|
|
238
|
+
transform: "translate(-50%, -50%)"
|
|
239
|
+
})
|
|
240
|
+
}
|
|
241
|
+
)
|
|
242
|
+
}
|
|
243
|
+
),
|
|
244
|
+
radio: /* @__PURE__ */ r(w, { children: s && /* @__PURE__ */ r(
|
|
245
|
+
h,
|
|
246
|
+
{
|
|
247
|
+
borderRadius: "4px",
|
|
248
|
+
boxSize: "18px",
|
|
249
|
+
pos: "relative",
|
|
250
|
+
transition: "background-color 0.1s ease-in-out",
|
|
251
|
+
children: /* @__PURE__ */ r(
|
|
252
|
+
E,
|
|
253
|
+
{
|
|
254
|
+
className: k({
|
|
255
|
+
position: "absolute",
|
|
256
|
+
top: "55%",
|
|
257
|
+
left: "50%",
|
|
258
|
+
transform: "translate(-50%, -50%)",
|
|
259
|
+
color: "inherit"
|
|
260
|
+
})
|
|
261
|
+
}
|
|
262
|
+
)
|
|
263
|
+
}
|
|
264
|
+
) }),
|
|
265
|
+
default: null
|
|
266
|
+
}[b],
|
|
267
|
+
c
|
|
268
|
+
]
|
|
269
|
+
}
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
function Q({ ...t }) {
|
|
273
|
+
return /* @__PURE__ */ r(
|
|
274
|
+
h,
|
|
275
|
+
{
|
|
276
|
+
bg: "var(--border, light-dark(#E4E4E4,#434343)",
|
|
277
|
+
h: "1px",
|
|
278
|
+
styleOrder: 1,
|
|
279
|
+
w: "100%",
|
|
280
|
+
...t
|
|
281
|
+
}
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
export {
|
|
285
|
+
G as Select,
|
|
286
|
+
K as SelectContainer,
|
|
287
|
+
Q as SelectDivider,
|
|
288
|
+
M as SelectOption,
|
|
289
|
+
J as SelectTrigger,
|
|
290
|
+
v as useSelect
|
|
291
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime");function i({...n}){return e.jsx("svg",{fill:"none",height:"28",viewBox:"0 0 28 28",width:"28",xmlns:"http://www.w3.org/2000/svg",...n,children:e.jsx("path",{clipRule:"evenodd",d:"M9 14C9 13.4477 9.3731 13 9.83333 13H18.1667C18.6269 13 19 13.4477 19 14C19 14.5523 18.6269 15 18.1667 15H9.83333C9.3731 15 9 14.5523 9 14Z",fill:"currentColor",fillRule:"evenodd"})})}exports.IconMinus=i;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
function o({ ...l }) {
|
|
3
|
+
return /* @__PURE__ */ e(
|
|
4
|
+
"svg",
|
|
5
|
+
{
|
|
6
|
+
fill: "none",
|
|
7
|
+
height: "28",
|
|
8
|
+
viewBox: "0 0 28 28",
|
|
9
|
+
width: "28",
|
|
10
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11
|
+
...l,
|
|
12
|
+
children: /* @__PURE__ */ e(
|
|
13
|
+
"path",
|
|
14
|
+
{
|
|
15
|
+
clipRule: "evenodd",
|
|
16
|
+
d: "M9 14C9 13.4477 9.3731 13 9.83333 13H18.1667C18.6269 13 19 13.4477 19 14C19 14.5523 18.6269 15 18.1667 15H9.83333C9.3731 15 9 14.5523 9 14Z",
|
|
17
|
+
fill: "currentColor",
|
|
18
|
+
fillRule: "evenodd"
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
o as IconMinus
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime");function n({...t}){return e.jsx("svg",{fill:"none",height:"28",viewBox:"0 0 28 28",width:"28",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M14.8333 9.83333C14.8333 9.3731 14.4602 9 14 9C13.5397 9 13.1666 9.3731 13.1666 9.83333V13.1667H9.8333C9.37307 13.1667 8.99997 13.5398 8.99997 14C8.99997 14.4602 9.37307 14.8333 9.8333 14.8333H13.1666V18.1667C13.1666 18.6269 13.5397 19 14 19C14.4602 19 14.8333 18.6269 14.8333 18.1667V14.8333H18.1666C18.6269 14.8333 19 14.4602 19 14C19 13.5398 18.6269 13.1667 18.1666 13.1667H14.8333V9.83333Z",fill:"currentColor"})})}exports.IconPlus=n;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
function n({ ...r }) {
|
|
3
|
+
return /* @__PURE__ */ o(
|
|
4
|
+
"svg",
|
|
5
|
+
{
|
|
6
|
+
fill: "none",
|
|
7
|
+
height: "28",
|
|
8
|
+
viewBox: "0 0 28 28",
|
|
9
|
+
width: "28",
|
|
10
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
11
|
+
...r,
|
|
12
|
+
children: /* @__PURE__ */ o(
|
|
13
|
+
"path",
|
|
14
|
+
{
|
|
15
|
+
d: "M14.8333 9.83333C14.8333 9.3731 14.4602 9 14 9C13.5397 9 13.1666 9.3731 13.1666 9.83333V13.1667H9.8333C9.37307 13.1667 8.99997 13.5398 8.99997 14C8.99997 14.4602 9.37307 14.8333 9.8333 14.8333H13.1666V18.1667C13.1666 18.6269 13.5397 19 14 19C14.4602 19 14.8333 18.6269 14.8333 18.1667V14.8333H18.1666C18.6269 14.8333 19 14.4602 19 14C19 13.5398 18.6269 13.1667 18.1666 13.1667H14.8333V9.83333Z",
|
|
16
|
+
fill: "currentColor"
|
|
17
|
+
}
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
n as IconPlus
|
|
24
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),o=require("@devup-ui/react"),m=require("clsx"),d=require("react"),b=require("../Button/index.cjs"),h=require("../Input/index.cjs"),g=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:r,value:n,onValueChange:s,min:t=0,max:i=100,type:u="input"}){const[l,p]=d.useState(r??0),v=F=>{const x=Math.min(Math.max(F,t),i);if(s){s(x);return}p(x)};return a.jsx(S.Provider,{value:{value:n??l,setValue:v,min:t,max:i,type:u},children:e})}function C(e){return a.jsx(o.Flex,{alignItems:"center",gap:"8px",styleOrder:1,...e})}function y({...e}){const{value:r,setValue:n,min:s}=c(),t=r<=s;return a.jsx(b.Button,{"aria-label":"Decrease button",className:o.css({p:"0",boxSize:"28px",borderRadius:"4px"}),disabled:t,onClick:()=>n(r-1),...e,children:a.jsx(g.IconMinus,{className:o.css({color:t?"var(--base10, light-dark(#0000001A,#FFFFFF1A))":"var(--text, light-dark(#272727, #F6F6F6))"})})})}function j({...e}){const{value:r,setValue:n,max:s}=c(),t=r>=s;return a.jsx(b.Button,{"aria-label":"Increase button",className:o.css({p:"0",boxSize:"28px",borderRadius:"4px",selectors:{"&>div>div":{}}}),disabled:t,onClick:()=>n(r+1),...e,children:a.jsx(I.IconPlus,{className:o.css({color:t?"var(--base10, light-dark(#0000001A,#FFFFFF1A))":"var(--text, light-dark(#272727, #F6F6F6))"})})})}function k({className:e,...r}){const{value:n,setValue:s,type:t}=c(),i=o.css({p:"0",border:"none",w:"fit-content",h:"fit-content",styleOrder:3}),u=t==="input",l=u?h.Input:"div";return a.jsx(l,{allowClear:!1,"aria-label":"Stepper value",className:m(o.css({styleOrder:2,w:"60px",textAlign:"center",borderRadius:"6px",selectors:{"&::-webkit-outer-spin-button, &::-webkit-inner-spin-button":{display:"none"}}}),!u&&i,e),dangerouslySetInnerHTML:u?void 0:{__html:Number(n).toString()},"data-value":n,onChange:p=>s(Number(p.target.value)),readOnly:!u,type:"number",value:n,...r})}exports.Stepper=f;exports.StepperContainer=C;exports.StepperDecreaseButton=y;exports.StepperIncreaseButton=j;exports.StepperInput=k;exports.useStepper=c;
|
|
@@ -6,6 +6,7 @@ type StepperContextType = {
|
|
|
6
6
|
setValue: (value: number) => void;
|
|
7
7
|
min: number;
|
|
8
8
|
max: number;
|
|
9
|
+
type: 'input' | 'text';
|
|
9
10
|
};
|
|
10
11
|
export declare const useStepper: () => StepperContextType;
|
|
11
12
|
type StepperProps = {
|
|
@@ -15,14 +16,15 @@ type StepperProps = {
|
|
|
15
16
|
onValueChange?: (value: number) => void;
|
|
16
17
|
min?: number;
|
|
17
18
|
max?: number;
|
|
19
|
+
type?: 'input' | 'text';
|
|
18
20
|
};
|
|
19
|
-
declare function Stepper({ children, defaultValue, value: valueProp, onValueChange, min, max, }: StepperProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
declare function Stepper({ children, defaultValue, value: valueProp, onValueChange, min, max, type, }: StepperProps): import("react/jsx-runtime").JSX.Element;
|
|
20
22
|
declare function StepperContainer(props: ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
21
23
|
declare function StepperDecreaseButton({ ...props }: ComponentProps<typeof Button>): import("react/jsx-runtime").JSX.Element;
|
|
22
24
|
declare function StepperIncreaseButton({ ...props }: ComponentProps<typeof Button>): import("react/jsx-runtime").JSX.Element;
|
|
23
25
|
interface StepperInputProps extends ComponentProps<typeof Input> {
|
|
24
26
|
editable?: boolean;
|
|
25
27
|
}
|
|
26
|
-
declare function StepperInput({
|
|
28
|
+
declare function StepperInput({ className, ...props }: StepperInputProps): import("react/jsx-runtime").JSX.Element;
|
|
27
29
|
export { Stepper, StepperContainer, StepperDecreaseButton, StepperIncreaseButton, StepperInput, };
|
|
28
30
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Stepper/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAuC,MAAM,OAAO,CAAA;AAE3E,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAIhC,KAAK,kBAAkB,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Stepper/index.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAuC,MAAM,OAAO,CAAA;AAE3E,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAIhC,KAAK,kBAAkB,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,OAAO,GAAG,MAAM,CAAA;CACvB,CAAA;AAID,eAAO,MAAM,UAAU,0BAMtB,CAAA;AAED,KAAK,YAAY,GAAG;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CACxB,CAAA;AAED,iBAAS,OAAO,CAAC,EACf,QAAQ,EACR,YAAY,EACZ,KAAK,EAAE,SAAS,EAChB,aAAa,EACb,GAAO,EACP,GAAS,EACT,IAAc,GACf,EAAE,YAAY,2CAyBd;AAED,iBAAS,gBAAgB,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,2CAErD;AAED,iBAAS,qBAAqB,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,2CAwBzE;AAED,iBAAS,qBAAqB,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,2CA2BzE;AAED,UAAU,iBAAkB,SAAQ,cAAc,CAAC,OAAO,KAAK,CAAC;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,2CA0C/D;AAED,OAAO,EACL,OAAO,EACP,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,YAAY,GACb,CAAA"}
|
|
@@ -1,33 +1,148 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import "@devup-ui/react";
|
|
4
|
-
import "clsx";
|
|
5
|
-
import { useState as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { Flex as F, css as i } from "@devup-ui/react";
|
|
4
|
+
import f from "clsx";
|
|
5
|
+
import { useState as S, createContext as h, useContext as g } from "react";
|
|
6
|
+
import { Button as m } from "../Button/index.js";
|
|
7
|
+
import { Input as C } from "../Input/index.js";
|
|
8
|
+
import { IconMinus as k } from "./IconMinus.js";
|
|
9
|
+
import { IconPlus as w } from "./IconPlus.js";
|
|
10
|
+
const b = h(null), p = () => {
|
|
11
|
+
const e = g(b);
|
|
12
|
+
if (!e)
|
|
13
|
+
throw new Error("useStepper must be used within a StepperProvider");
|
|
14
|
+
return e;
|
|
15
|
+
};
|
|
16
|
+
function B({
|
|
17
|
+
children: e,
|
|
18
|
+
defaultValue: r,
|
|
19
|
+
value: n,
|
|
20
|
+
onValueChange: o,
|
|
21
|
+
min: t = 0,
|
|
22
|
+
max: l = 100,
|
|
23
|
+
type: s = "input"
|
|
14
24
|
}) {
|
|
15
|
-
const [
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
|
|
25
|
+
const [c, u] = S(r ?? 0), x = (v) => {
|
|
26
|
+
const d = Math.min(Math.max(v, t), l);
|
|
27
|
+
if (o) {
|
|
28
|
+
o(d);
|
|
19
29
|
return;
|
|
20
30
|
}
|
|
21
|
-
|
|
31
|
+
u(d);
|
|
22
32
|
};
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
-
|
|
33
|
+
return /* @__PURE__ */ a(
|
|
34
|
+
b.Provider,
|
|
35
|
+
{
|
|
36
|
+
value: {
|
|
37
|
+
value: n ?? c,
|
|
38
|
+
setValue: x,
|
|
39
|
+
min: t,
|
|
40
|
+
max: l,
|
|
41
|
+
type: s
|
|
42
|
+
},
|
|
43
|
+
children: e
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
function P(e) {
|
|
48
|
+
return /* @__PURE__ */ a(F, { alignItems: "center", gap: "8px", styleOrder: 1, ...e });
|
|
49
|
+
}
|
|
50
|
+
function R({ ...e }) {
|
|
51
|
+
const { value: r, setValue: n, min: o } = p(), t = r <= o;
|
|
52
|
+
return /* @__PURE__ */ a(
|
|
53
|
+
m,
|
|
54
|
+
{
|
|
55
|
+
"aria-label": "Decrease button",
|
|
56
|
+
className: i({
|
|
57
|
+
p: "0",
|
|
58
|
+
boxSize: "28px",
|
|
59
|
+
borderRadius: "4px"
|
|
60
|
+
}),
|
|
61
|
+
disabled: t,
|
|
62
|
+
onClick: () => n(r - 1),
|
|
63
|
+
...e,
|
|
64
|
+
children: /* @__PURE__ */ a(
|
|
65
|
+
k,
|
|
66
|
+
{
|
|
67
|
+
className: i({
|
|
68
|
+
color: t ? "var(--base10, light-dark(#0000001A,#FFFFFF1A))" : "var(--text, light-dark(#272727, #F6F6F6))"
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
function D({ ...e }) {
|
|
76
|
+
const { value: r, setValue: n, max: o } = p(), t = r >= o;
|
|
77
|
+
return /* @__PURE__ */ a(
|
|
78
|
+
m,
|
|
79
|
+
{
|
|
80
|
+
"aria-label": "Increase button",
|
|
81
|
+
className: i({
|
|
82
|
+
p: "0",
|
|
83
|
+
boxSize: "28px",
|
|
84
|
+
borderRadius: "4px",
|
|
85
|
+
selectors: {
|
|
86
|
+
"&>div>div": {}
|
|
87
|
+
}
|
|
88
|
+
}),
|
|
89
|
+
disabled: t,
|
|
90
|
+
onClick: () => n(r + 1),
|
|
91
|
+
...e,
|
|
92
|
+
children: /* @__PURE__ */ a(
|
|
93
|
+
w,
|
|
94
|
+
{
|
|
95
|
+
className: i({
|
|
96
|
+
color: t ? "var(--base10, light-dark(#0000001A,#FFFFFF1A))" : "var(--text, light-dark(#272727, #F6F6F6))"
|
|
97
|
+
})
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
function E({ className: e, ...r }) {
|
|
104
|
+
const { value: n, setValue: o, type: t } = p(), l = i({
|
|
105
|
+
p: "0",
|
|
106
|
+
border: "none",
|
|
107
|
+
w: "fit-content",
|
|
108
|
+
h: "fit-content",
|
|
109
|
+
styleOrder: 3
|
|
110
|
+
}), s = t === "input";
|
|
111
|
+
return /* @__PURE__ */ a(
|
|
112
|
+
s ? C : "div",
|
|
25
113
|
{
|
|
26
|
-
|
|
27
|
-
|
|
114
|
+
allowClear: !1,
|
|
115
|
+
"aria-label": "Stepper value",
|
|
116
|
+
className: f(
|
|
117
|
+
i({
|
|
118
|
+
styleOrder: 2,
|
|
119
|
+
w: "60px",
|
|
120
|
+
textAlign: "center",
|
|
121
|
+
borderRadius: "6px",
|
|
122
|
+
selectors: {
|
|
123
|
+
"&::-webkit-outer-spin-button, &::-webkit-inner-spin-button": {
|
|
124
|
+
display: "none"
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}),
|
|
128
|
+
!s && l,
|
|
129
|
+
e
|
|
130
|
+
),
|
|
131
|
+
dangerouslySetInnerHTML: s ? void 0 : { __html: Number(n).toString() },
|
|
132
|
+
"data-value": n,
|
|
133
|
+
onChange: (u) => o(Number(u.target.value)),
|
|
134
|
+
readOnly: !s,
|
|
135
|
+
type: "number",
|
|
136
|
+
value: n,
|
|
137
|
+
...r
|
|
28
138
|
}
|
|
29
139
|
);
|
|
30
140
|
}
|
|
31
141
|
export {
|
|
32
|
-
|
|
142
|
+
B as Stepper,
|
|
143
|
+
P as StepperContainer,
|
|
144
|
+
R as StepperDecreaseButton,
|
|
145
|
+
D as StepperIncreaseButton,
|
|
146
|
+
E as StepperInput,
|
|
147
|
+
p as useStepper
|
|
33
148
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./components/Button/index.cjs"),n=require("./components/Input/index.cjs"),e=require("./components/Select/index.cjs"),t=require("./components/Stepper/index.cjs");exports.Button=r.Button;exports.Input=n.Input;exports.Select=e.Select;exports.SelectContainer=e.SelectContainer;exports.SelectDivider=e.SelectDivider;exports.SelectOption=e.SelectOption;exports.SelectTrigger=e.SelectTrigger;exports.useSelect=e.useSelect;exports.Stepper=t.Stepper;exports.StepperContainer=t.StepperContainer;exports.StepperDecreaseButton=t.StepperDecreaseButton;exports.StepperIncreaseButton=t.StepperIncreaseButton;exports.StepperInput=t.StepperInput;exports.useStepper=t.useStepper;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { Button } from './components/Button';
|
|
2
2
|
export { Input } from './components/Input';
|
|
3
|
-
export {
|
|
3
|
+
export { Select, SelectContainer, SelectDivider, SelectOption, SelectTrigger, useSelect, } from './components/Select';
|
|
4
|
+
export { Stepper, StepperContainer, StepperDecreaseButton, StepperIncreaseButton, StepperInput, useStepper, } from './components/Stepper';
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EACL,MAAM,EACN,eAAe,EACf,aAAa,EACb,YAAY,EACZ,aAAa,EACb,SAAS,GACV,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,OAAO,EACP,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,YAAY,EACZ,UAAU,GACX,MAAM,sBAAsB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
import { Button as
|
|
2
|
-
import { Input as
|
|
3
|
-
import {
|
|
1
|
+
import { Button as r } from "./components/Button/index.js";
|
|
2
|
+
import { Input as o } from "./components/Input/index.js";
|
|
3
|
+
import { Select as n, SelectContainer as c, SelectDivider as u, SelectOption as i, SelectTrigger as l, useSelect as a } from "./components/Select/index.js";
|
|
4
|
+
import { Stepper as m, StepperContainer as s, StepperDecreaseButton as x, StepperIncreaseButton as B, StepperInput as I, useStepper as g } from "./components/Stepper/index.js";
|
|
4
5
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
r as Button,
|
|
7
|
+
o as Input,
|
|
8
|
+
n as Select,
|
|
9
|
+
c as SelectContainer,
|
|
10
|
+
u as SelectDivider,
|
|
11
|
+
i as SelectOption,
|
|
12
|
+
l as SelectTrigger,
|
|
13
|
+
m as Stepper,
|
|
14
|
+
s as StepperContainer,
|
|
15
|
+
x as StepperDecreaseButton,
|
|
16
|
+
B as StepperIncreaseButton,
|
|
17
|
+
I as StepperInput,
|
|
18
|
+
a as useSelect,
|
|
19
|
+
g as useStepper
|
|
8
20
|
};
|