@devup-ui/components 0.1.43 → 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.
Files changed (34) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +1 -0
  2. package/dist/components/Button/IconSpinner.cjs +1 -1
  3. package/dist/components/Button/IconSpinner.js +72 -84
  4. package/dist/components/Button/index.cjs +1 -1
  5. package/dist/components/Button/index.js +220 -217
  6. package/dist/components/Checkbox/CheckIcon.cjs +1 -1
  7. package/dist/components/Checkbox/CheckIcon.js +17 -23
  8. package/dist/components/Checkbox/index.cjs +1 -2
  9. package/dist/components/Checkbox/index.js +87 -127
  10. package/dist/components/Input/index.cjs +1 -2
  11. package/dist/components/Input/index.js +130 -181
  12. package/dist/components/Radio/index.cjs +1 -1
  13. package/dist/components/Radio/index.js +143 -194
  14. package/dist/components/RadioGroup/index.cjs +1 -2
  15. package/dist/components/RadioGroup/index.js +43 -59
  16. package/dist/components/Select/IconCheck.cjs +1 -1
  17. package/dist/components/Select/IconCheck.js +18 -24
  18. package/dist/components/Select/index.cjs +1 -2
  19. package/dist/components/Select/index.js +215 -315
  20. package/dist/components/Stepper/IconMinus.cjs +1 -1
  21. package/dist/components/Stepper/IconMinus.js +18 -24
  22. package/dist/components/Stepper/IconPlus.cjs +1 -1
  23. package/dist/components/Stepper/IconPlus.js +17 -23
  24. package/dist/components/Stepper/index.cjs +1 -2
  25. package/dist/components/Stepper/index.js +98 -142
  26. package/dist/components/Textarea/index.cjs +1 -2
  27. package/dist/components/Textarea/index.js +85 -108
  28. package/dist/components/Toggle/index.cjs +1 -2
  29. package/dist/components/Toggle/index.js +71 -91
  30. package/dist/contexts/useSelect.cjs +1 -2
  31. package/dist/contexts/useSelect.js +9 -10
  32. package/dist/index.cjs +1 -1
  33. package/dist/index.js +11 -32
  34. package/package.json +11 -11
@@ -1,195 +1,144 @@
1
- import { jsxs as n, jsx as a } from "react/jsx-runtime";
2
- import { Box as g, Input as v, Text as B } from "@devup-ui/react";
3
- function m({
4
- className: o,
5
- disabled: e,
6
- children: i,
7
- variant: t = "default",
8
- checked: b,
9
- classNames: p,
10
- styles: s,
11
- style: l,
12
- firstButton: c,
13
- lastButton: k,
14
- colors: r,
15
- ...h
16
- }) {
17
- const d = t === "button";
18
- return /* @__PURE__ */ n(
19
- g,
20
- {
21
- alignItems: d ? void 0 : "center",
22
- "aria-disabled": e,
23
- as: "label",
24
- cursor: d ? void 0 : "pointer",
25
- display: d ? void 0 : "inline-flex",
26
- gap: d ? void 0 : 2,
27
- selectors: {
28
- "&[aria-disabled=true]": {
29
- cursor: "default"
30
- }
31
- },
32
- children: [
33
- d ? /* @__PURE__ */ a(
34
- v,
35
- {
36
- checked: b,
37
- className: o,
38
- "data-radio-input": !0,
39
- disabled: e,
40
- display: "none",
41
- opacity: 0,
42
- styleOrder: 1,
43
- type: "radio",
44
- ...h
45
- }
46
- ) : /* @__PURE__ */ a(
47
- v,
48
- {
49
- _focus: {
50
- outline: "1px sold var(--border, var(--primary))"
51
- },
52
- appearance: "none",
53
- bg: "light-dark(#fff, #2E2E2E)",
54
- border: "1px solid",
55
- borderColor: "$border",
56
- borderRadius: "100%",
57
- checked: b,
58
- className: o,
59
- "data-radio-input": !0,
60
- disabled: e,
61
- height: "18px",
62
- m: 0,
63
- selectors: {
64
- // checked
65
- "&:checked:not(:disabled)": {
66
- bg: "var(--checkedBg, var(--primary, light-dark(#fff, #2E2E2E)))",
67
- border: "3px solid",
68
- borderColor: "var(--checkedBg, light-dark(#fff, #2E2E2E))",
69
- boxShadow: "0 0 0 1px var(--checkedBorder, var(--primary))"
70
- },
71
- // hover
72
- "&:hover:not(:disabled,:checked)": {
73
- border: "1px solid var(--hoverBorder, var(--primary))",
74
- bg: "var(--hoverBg, light-dark(color-mix(in srgb, var(--primary) 10%, white 90%), color-mix(in srgb, var(--primary) 10%, black 90%)))"
75
- },
76
- // disabled
77
- "&:is(:disabled, [aria-disabled=true])": {
78
- bgColor: "var(--disabledBg, light-dark(#F0F0F3, #47474A))"
79
- }
80
- },
81
- styleOrder: 1,
82
- styleVars: {
83
- primary: r?.primary,
84
- border: r?.border,
85
- text: r?.text,
86
- bg: r?.bg,
87
- hoverBg: r?.hoverBg,
88
- hoverBorder: r?.hoverBorder,
89
- hoverColor: r?.hoverColor,
90
- checkedBg: r?.checkedBg,
91
- checkedBorder: r?.checkedBorder,
92
- checkedColor: r?.checkedColor,
93
- disabledBg: r?.disabledBg,
94
- disabledColor: r?.disabledColor
95
- },
96
- transition: ".25s",
97
- type: "radio",
98
- width: "18px",
99
- ...h
100
- }
101
- ),
102
- t === "button" ? /* @__PURE__ */ a(
103
- g,
104
- {
105
- _disabled: {
106
- cursor: "not-allowed"
107
- },
108
- "aria-disabled": e,
109
- bg: "var(--bg, light-dark(#fff, #2E2E2E))",
110
- border: "1px solid",
111
- borderColor: "$border",
112
- borderRadius: c ? "8px 0 0 8px" : k ? "0 8px 8px 0" : void 0,
113
- className: o,
114
- color: "var(--text, light-dark(#000, #fff))",
115
- cursor: "pointer",
116
- "data-radio-button": !0,
117
- display: "flex",
118
- px: 8,
119
- py: 3,
120
- selectors: {
121
- // checked
122
- "[data-radio-input]:checked + &:not([aria-disabled=true])": {
123
- fontWeight: 600,
124
- bg: "var(--checkedBg, light-dark(color-mix(in srgb, var(--primary) 10%, white 80%), color-mix(in srgb, var(--primary) 10%, black 80%)))",
125
- borderColor: "var(--checkedBorder, var(--primary))",
126
- color: "var(--checkedColor, var(--primary))"
127
- },
128
- // hover
129
- "&:hover:not([aria-disabled=true])": {
130
- bg: "var(--hoverBg, light-dark(color-mix(in srgb, var(--primary) 10%, white 90%), color-mix(in srgb, var(--primary) 10%, black 90%)))",
131
- borderColor: "var(--hoverBorder, var(--primary))"
132
- },
133
- // disabled
134
- "[data-radio-input]:disabled + &": {
135
- bg: "var(--disabledBg, light-dark(#F0F0F3, #47474A))",
136
- color: "var(--disabledColor, light-dark(#D6D7DE, #373737))"
137
- }
138
- },
139
- style: l,
140
- styleOrder: 1,
141
- styleVars: {
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
- export {
194
- m as Radio
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
- import { jsx as e } from "react/jsx-runtime";
3
- import { Flex as a } from "@devup-ui/react";
4
- import { useState as b } from "react";
5
- import { Radio as x } from "../Radio/index.js";
6
- function G({
7
- disabled: i,
8
- options: u,
9
- direction: c = "row",
10
- variant: t = "default",
11
- style: S,
12
- value: n,
13
- onChange: d,
14
- defaultValue: p,
15
- colors: g,
16
- className: w,
17
- classNames: m,
18
- styles: f
19
- }) {
20
- const [V, B] = b(
21
- n ? String(n) : p ? String(p) : void 0
22
- ), C = n ? String(n) : V ?? "";
23
- function R(r) {
24
- d?.(r), B(r);
25
- }
26
- return /* @__PURE__ */ e(
27
- a,
28
- {
29
- className: m?.container,
30
- flexDir: t === "button" ? "row" : c,
31
- gap: t === "button" ? 0 : c === "row" ? "30px" : "16px",
32
- style: f?.container,
33
- children: u.map(({ value: r, label: h }, s) => {
34
- const o = String(r), l = {
35
- checked: C === o,
36
- disabled: i,
37
- onChange: () => !i && R(o),
38
- className: w,
39
- classNames: m,
40
- styles: f,
41
- style: S
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
- export {
60
- G as RadioGroup
61
- };
44
+ //#endregion
45
+ export { i as RadioGroup };
@@ -1 +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
+ 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
- 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
- );
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
- export {
25
- n as IconCheck
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;