@aivex/ui 1.2.0-dev.60 → 1.2.0-dev.61
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/README.md +6 -6
- package/dist/DESIGN.md +1 -1
- package/dist/components/Autocomplete/Autocomplete.cjs +2 -0
- package/dist/components/Autocomplete/Autocomplete.cjs.map +1 -0
- package/dist/components/Autocomplete/Autocomplete.d.cts +157 -0
- package/dist/components/Autocomplete/Autocomplete.d.ts +157 -0
- package/dist/components/Autocomplete/Autocomplete.js +192 -0
- package/dist/components/Autocomplete/Autocomplete.js.map +1 -0
- package/dist/components/Autocomplete/index.d.cts +2 -0
- package/dist/components/Autocomplete/index.d.ts +2 -0
- package/dist/components/Avatar/Avatar.cjs +1 -1
- package/dist/components/Avatar/Avatar.cjs.map +1 -1
- package/dist/components/Avatar/Avatar.js +8 -8
- package/dist/components/Button/Button.cjs +1 -1
- package/dist/components/Button/Button.cjs.map +1 -1
- package/dist/components/Button/Button.js +6 -6
- package/dist/components/Coachmark/Coachmark.cjs +1 -1
- package/dist/components/Coachmark/Coachmark.js +14 -14
- package/dist/components/Comment/CommentInput.cjs +1 -1
- package/dist/components/Comment/CommentInput.js +6 -6
- package/dist/components/IconButton/IconButton.cjs +1 -1
- package/dist/components/IconButton/IconButton.cjs.map +1 -1
- package/dist/components/IconButton/IconButton.js +6 -6
- package/dist/components/Menu/Menu.cjs +1 -1
- package/dist/components/Menu/Menu.js +21 -21
- package/dist/components/Modal/Modal.cjs +1 -1
- package/dist/components/Modal/Modal.js +17 -17
- package/dist/components/NumberField/NumberField.cjs +1 -1
- package/dist/components/NumberField/NumberField.js +7 -7
- package/dist/components/Popover/Popover.cjs.map +1 -1
- package/dist/components/Popover/Popover.d.cts +5 -0
- package/dist/components/Popover/Popover.d.ts +5 -0
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/SelectBox/SelectBox.cjs +1 -1
- package/dist/components/SelectBox/SelectBox.js +4 -4
- package/dist/components/SelectButton/SelectButton.cjs +1 -1
- package/dist/components/SelectButton/SelectButton.js +5 -5
- package/dist/components/Tagbox/Tagbox.cjs +1 -1
- package/dist/components/Tagbox/Tagbox.js +8 -8
- package/dist/components/Textarea/Textarea.cjs +1 -1
- package/dist/components/Textarea/Textarea.js +6 -6
- package/dist/components/Textbox/Textbox.cjs +1 -1
- package/dist/components/Textbox/Textbox.js +10 -10
- package/dist/components/Toast/Toast.cjs +1 -1
- package/dist/components/Toast/Toast.js +4 -4
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +61 -60
- package/dist/llms-full.txt +69 -2
- package/dist/llms.txt +3 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
import { CheckIcon as e, DirectionRightIcon as t } from "../Icon/index.js";
|
|
4
4
|
import { cn as n } from "../../utils.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { InteractionLayer as r } from "../InteractionLayer/InteractionLayer.js";
|
|
6
|
+
import { PortalEventBoundary as i } from "../../utils/PortalEventBoundary.js";
|
|
7
7
|
import { splitPositioningProps as a } from "../../utils/popupPositioning.js";
|
|
8
8
|
import { createContext as o, use as s } from "react";
|
|
9
9
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
@@ -29,11 +29,11 @@ function _({ ref: e, onClick: t, ...n }) {
|
|
|
29
29
|
...n
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
function v({ className: e, container: t, keepMounted:
|
|
32
|
+
function v({ className: e, container: t, keepMounted: r, ref: o, ...s }) {
|
|
33
33
|
let [{ sideOffset: l = 4, ...u }, f] = a(s);
|
|
34
|
-
return /* @__PURE__ */ c(
|
|
34
|
+
return /* @__PURE__ */ c(i, { children: /* @__PURE__ */ c(d.Portal, {
|
|
35
35
|
container: t,
|
|
36
|
-
keepMounted:
|
|
36
|
+
keepMounted: r,
|
|
37
37
|
children: /* @__PURE__ */ c(d.Positioner, {
|
|
38
38
|
sideOffset: l,
|
|
39
39
|
className: m,
|
|
@@ -71,7 +71,7 @@ function x({ className: e, ref: t, ...r }) {
|
|
|
71
71
|
...r
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
-
function S({ className: e, label: t, icon:
|
|
74
|
+
function S({ className: e, label: t, icon: i, danger: a = !1, children: o, ref: s, ...u }) {
|
|
75
75
|
let p = t ?? o;
|
|
76
76
|
return /* @__PURE__ */ l(d.Item, {
|
|
77
77
|
ref: s,
|
|
@@ -79,10 +79,10 @@ function S({ className: e, label: t, icon: r, danger: a = !1, children: o, ref:
|
|
|
79
79
|
label: typeof t == "string" ? t : void 0,
|
|
80
80
|
...u,
|
|
81
81
|
children: [
|
|
82
|
-
/* @__PURE__ */ c(
|
|
83
|
-
|
|
82
|
+
/* @__PURE__ */ c(r, { variant: a ? "danger" : "default" }),
|
|
83
|
+
i && /* @__PURE__ */ c("span", {
|
|
84
84
|
className: n("aivex:flex aivex:items-center aivex:justify-center aivex:shrink-0", a ? "aivex:text-icon-danger" : "aivex:text-icon-secondary"),
|
|
85
|
-
children:
|
|
85
|
+
children: i
|
|
86
86
|
}),
|
|
87
87
|
/* @__PURE__ */ c("span", {
|
|
88
88
|
className: "aivex:flex-1 aivex:min-w-0 aivex:truncate aivex:text-left",
|
|
@@ -91,16 +91,16 @@ function S({ className: e, label: t, icon: r, danger: a = !1, children: o, ref:
|
|
|
91
91
|
]
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
-
function C({ className: t, label:
|
|
95
|
-
let m =
|
|
94
|
+
function C({ className: t, label: i, icon: a, closeOnClick: o = !0, children: s, ref: u, ...p }) {
|
|
95
|
+
let m = i ?? s;
|
|
96
96
|
return /* @__PURE__ */ l(d.CheckboxItem, {
|
|
97
97
|
ref: u,
|
|
98
98
|
className: n(f(), t),
|
|
99
|
-
label: typeof
|
|
99
|
+
label: typeof i == "string" ? i : void 0,
|
|
100
100
|
closeOnClick: o,
|
|
101
101
|
...p,
|
|
102
102
|
children: [
|
|
103
|
-
/* @__PURE__ */ c(
|
|
103
|
+
/* @__PURE__ */ c(r, { variant: "default" }),
|
|
104
104
|
/* @__PURE__ */ c(A, { children: /* @__PURE__ */ c(d.CheckboxItemIndicator, {
|
|
105
105
|
className: "aivex:flex",
|
|
106
106
|
children: /* @__PURE__ */ c(e, { size: 20 })
|
|
@@ -126,16 +126,16 @@ function w({ className: e, ref: t, ...r }) {
|
|
|
126
126
|
})
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
-
function T({ className: t, label:
|
|
130
|
-
let m =
|
|
129
|
+
function T({ className: t, label: i, icon: a, closeOnClick: o = !0, children: s, ref: u, ...p }) {
|
|
130
|
+
let m = i ?? s;
|
|
131
131
|
return /* @__PURE__ */ l(d.RadioItem, {
|
|
132
132
|
ref: u,
|
|
133
133
|
className: n(f(), t),
|
|
134
|
-
label: typeof
|
|
134
|
+
label: typeof i == "string" ? i : void 0,
|
|
135
135
|
closeOnClick: o,
|
|
136
136
|
...p,
|
|
137
137
|
children: [
|
|
138
|
-
/* @__PURE__ */ c(
|
|
138
|
+
/* @__PURE__ */ c(r, { variant: "default" }),
|
|
139
139
|
/* @__PURE__ */ c(A, { children: /* @__PURE__ */ c(d.RadioItemIndicator, {
|
|
140
140
|
className: "aivex:flex",
|
|
141
141
|
children: /* @__PURE__ */ c(e, { size: 20 })
|
|
@@ -161,15 +161,15 @@ function E({ className: e, ref: t, ...r }) {
|
|
|
161
161
|
function D(e) {
|
|
162
162
|
return /* @__PURE__ */ c(d.SubmenuRoot, { ...e });
|
|
163
163
|
}
|
|
164
|
-
function O({ className: e, label:
|
|
165
|
-
let p =
|
|
164
|
+
function O({ className: e, label: i, icon: a, children: o, ref: s, ...u }) {
|
|
165
|
+
let p = i ?? o;
|
|
166
166
|
return /* @__PURE__ */ l(d.SubmenuTrigger, {
|
|
167
167
|
ref: s,
|
|
168
168
|
className: n(f(), e),
|
|
169
|
-
label: typeof
|
|
169
|
+
label: typeof i == "string" ? i : void 0,
|
|
170
170
|
...u,
|
|
171
171
|
children: [
|
|
172
|
-
/* @__PURE__ */ c(
|
|
172
|
+
/* @__PURE__ */ c(r, { variant: "default" }),
|
|
173
173
|
a && /* @__PURE__ */ c("span", {
|
|
174
174
|
className: "aivex:flex aivex:items-center aivex:justify-center aivex:shrink-0 aivex:text-icon-secondary",
|
|
175
175
|
children: a
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../Icon/index.cjs`),t=require(`../../utils.cjs`),n=require(
|
|
1
|
+
"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../Icon/index.cjs`),t=require(`../../utils.cjs`),n=require(`../IconButton/IconButton.cjs`),r=require(`../../utils/PortalEventBoundary.cjs`),i=require(`../Button/Button.cjs`),a=require(`../Overlay/Overlay.cjs`),o=require(`../../utils/useModalFocus.cjs`);let s=require(`react`),c=require(`react/jsx-runtime`),l=require(`@base-ui/react/dialog`);var u=(0,s.createContext)(!1),d={sm:`aivex:max-w-modal-sm`,md:`aivex:max-w-modal-md`,lg:`aivex:max-w-modal-lg`,xl:`aivex:max-w-[960px]`,full:`aivex:h-[calc(100dvh-32px)] aivex:max-w-[calc(100vw-32px)]`},f=t.cn(`aivex:flex aivex:max-h-[80dvh] aivex:w-[85vw] aivex:flex-col aivex:gap-2xl aivex:overflow-hidden aivex:p-2xl`,`aivex:rounded-2xl aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:shadow-xl aivex:outline-none`),p=`aivex:flex aivex:w-full aivex:flex-col aivex:gap-xs`;function m({title:t,titleId:r,description:i,headingButton:a,onClose:o,closeAriaLabel:d=`Close modal`,closeButtonProps:f,ref:m,...g}){let _=(0,s.useContext)(u),v=(0,c.jsx)(`h2`,{...r?{id:r}:{},className:`aivex:m-0 aivex:whitespace-pre-line aivex:text-heading-xs aivex:text-text-primary aivex:break-words`,children:t}),y=i?(0,c.jsx)(`p`,{className:`aivex:m-0 aivex:whitespace-pre-line aivex:text-body-md-regular aivex:text-text-secondary aivex:break-words`,children:i}):null,b=(0,c.jsx)(n.IconButton,{...f,size:`md`,onClick:o,className:`aivex:shrink-0`,"aria-label":d,children:(0,c.jsx)(e.CloseIcon,{size:24})}),x=a?(0,c.jsx)(h,{button:a}):null;return(0,c.jsxs)(`div`,{ref:m,className:p,...g,children:[(0,c.jsxs)(`div`,{className:`aivex:flex aivex:w-full aivex:items-center aivex:justify-center aivex:gap-md`,children:[x,(0,c.jsx)(`div`,{className:`aivex:flex aivex:min-w-0 aivex:flex-1 aivex:flex-col aivex:justify-center`,children:_?(0,c.jsx)(l.Dialog.Title,{render:v}):v}),o?b:_&&(0,c.jsx)(l.Dialog.Close,{render:b})]}),_&&y?(0,c.jsx)(l.Dialog.Description,{render:y}):y]})}function h({button:e}){let{children:t,...r}=e;return(0,c.jsx)(n.IconButton,{size:`md`,className:`aivex:shrink-0`,...r,children:t})}function g({children:e,ref:t,...n}){return(0,c.jsx)(`div`,{ref:t,"data-aivex-modal-body":``,className:`aivex:flex aivex:min-h-0 aivex:flex-1 aivex:flex-col aivex:overflow-y-auto`,...n,children:e})}function _({tertiaryButton:e,secondaryButton:t,primaryButton:n,ref:r,...i}){return(0,c.jsxs)(`div`,{ref:r,className:`aivex:flex aivex:h-10 aivex:w-full aivex:items-center aivex:justify-end aivex:gap-lg`,...i,children:[(0,c.jsx)(`div`,{className:`aivex:flex aivex:min-w-0 aivex:flex-1 aivex:items-center aivex:justify-start`,children:e&&(0,c.jsx)(v,{button:e,variant:`ghost`,color:`secondary`,className:`aivex:min-w-9`})}),(0,c.jsxs)(`div`,{className:`aivex:flex aivex:shrink-0 aivex:items-center aivex:justify-end aivex:gap-lg`,children:[t&&(0,c.jsx)(v,{button:t,variant:`solid`,color:`secondary`,className:`aivex:min-w-[84px]`}),n&&(0,c.jsx)(v,{button:n,variant:`solid`,color:`primary`,className:`aivex:min-w-[84px]`})]})]})}function v({button:e,variant:t,color:n,className:r}){let{children:a,...o}=e;return(0,c.jsx)(i.Button,{variant:t,color:n,size:`lg`,className:r,...o,children:a})}function y({open:e,defaultOpen:n,onOpenChange:i,children:p,size:m=`md`,closeOnInteractOutside:h=!0,initialFocus:g,finalFocus:_}){let v=(0,s.useRef)(null),y=o.useModalFocus({open:e,modal:!0,initialFocus:g,finalFocus:_,popupRef:v});return(0,c.jsx)(l.Dialog.Root,{open:e,defaultOpen:n,onOpenChange:i,disablePointerDismissal:!h,children:(0,c.jsx)(r.PortalEventBoundary,{children:(0,c.jsxs)(l.Dialog.Portal,{children:[(0,c.jsx)(l.Dialog.Backdrop,{forceRender:!0,className:a.overlayVariants({variant:`dim`})}),(0,c.jsx)(l.Dialog.Popup,{ref:v,initialFocus:y.initialFocus,finalFocus:y.finalFocus,onFocusCapture:y.onFocusCapture,className:t.cn(`aivex:fixed aivex:left-1/2 aivex:top-1/2 aivex:z-(--aivex-z-modal)`,`aivex:-translate-x-1/2 aivex:-translate-y-1/2`,f,d[m]),children:(0,c.jsx)(u.Provider,{value:!0,children:p})})]})})})}function b({title:e,description:n,headingButton:r,children:i,tertiaryButton:a,secondaryButton:o,primaryButton:l,size:u=`md`,onClose:p,closeAriaLabel:h,closeButtonProps:v,ref:y}){let b=(0,s.useId)(),x=!!(a||o||l);return(0,c.jsxs)(`div`,{ref:y,role:`dialog`,"aria-labelledby":b,className:t.cn(f,d[u]),children:[(0,c.jsx)(m,{title:e,titleId:b,description:n,headingButton:r,onClose:p,closeAriaLabel:h,closeButtonProps:v}),i&&(0,c.jsx)(g,{children:i}),x&&(0,c.jsx)(_,{tertiaryButton:a,secondaryButton:o,primaryButton:l})]})}function x({open:e,defaultOpen:t,onOpenChange:n,title:r,description:i,headingButton:a,children:o,tertiaryButton:s,secondaryButton:l,primaryButton:u,size:d,closeOnInteractOutside:f,initialFocus:p,finalFocus:h,closeAriaLabel:v,closeButtonProps:b}){return(0,c.jsxs)(y,{open:e,defaultOpen:t,onOpenChange:n,size:d,closeOnInteractOutside:f,initialFocus:p,finalFocus:h,children:[(0,c.jsx)(m,{title:r,description:i,headingButton:a,closeAriaLabel:v,closeButtonProps:b}),o&&(0,c.jsx)(g,{children:o}),!!(s||l||u)&&(0,c.jsx)(_,{tertiaryButton:s,secondaryButton:l,primaryButton:u})]})}exports.Modal=x,exports.ModalSurface=b;
|
|
2
2
|
//# sourceMappingURL=Modal.cjs.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { CloseIcon as e } from "../Icon/index.js";
|
|
3
3
|
import { cn as t } from "../../utils.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { IconButton as n } from "../IconButton/IconButton.js";
|
|
5
|
+
import { PortalEventBoundary as r } from "../../utils/PortalEventBoundary.js";
|
|
6
|
+
import { Button as i } from "../Button/Button.js";
|
|
7
7
|
import { overlayVariants as a } from "../Overlay/Overlay.js";
|
|
8
8
|
import { useModalFocus as o } from "../../utils/useModalFocus.js";
|
|
9
9
|
import { createContext as s, useContext as c, useId as l, useRef as u } from "react";
|
|
@@ -17,15 +17,15 @@ var m = s(!1), h = {
|
|
|
17
17
|
xl: "aivex:max-w-[960px]",
|
|
18
18
|
full: "aivex:h-[calc(100dvh-32px)] aivex:max-w-[calc(100vw-32px)]"
|
|
19
19
|
}, g = t("aivex:flex aivex:max-h-[80dvh] aivex:w-[85vw] aivex:flex-col aivex:gap-2xl aivex:overflow-hidden aivex:p-2xl", "aivex:rounded-2xl aivex:border aivex:border-border-subtle aivex:bg-bg-primary aivex:shadow-xl aivex:outline-none"), _ = "aivex:flex aivex:w-full aivex:flex-col aivex:gap-xs";
|
|
20
|
-
function v({ title: t, titleId:
|
|
20
|
+
function v({ title: t, titleId: r, description: i, headingButton: a, onClose: o, closeAriaLabel: s = "Close modal", closeButtonProps: l, ref: u, ...h }) {
|
|
21
21
|
let g = c(m), v = /* @__PURE__ */ d("h2", {
|
|
22
|
-
...
|
|
22
|
+
...r ? { id: r } : {},
|
|
23
23
|
className: "aivex:m-0 aivex:whitespace-pre-line aivex:text-heading-xs aivex:text-text-primary aivex:break-words",
|
|
24
24
|
children: t
|
|
25
|
-
}), b =
|
|
25
|
+
}), b = i ? /* @__PURE__ */ d("p", {
|
|
26
26
|
className: "aivex:m-0 aivex:whitespace-pre-line aivex:text-body-md-regular aivex:text-text-secondary aivex:break-words",
|
|
27
|
-
children:
|
|
28
|
-
}) : null, x = /* @__PURE__ */ d(
|
|
27
|
+
children: i
|
|
28
|
+
}) : null, x = /* @__PURE__ */ d(n, {
|
|
29
29
|
...l,
|
|
30
30
|
size: "md",
|
|
31
31
|
onClick: o,
|
|
@@ -51,11 +51,11 @@ function v({ title: t, titleId: n, description: r, headingButton: a, onClose: o,
|
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
function y({ button: e }) {
|
|
54
|
-
let { children: t, ...
|
|
55
|
-
return /* @__PURE__ */ d(
|
|
54
|
+
let { children: t, ...r } = e;
|
|
55
|
+
return /* @__PURE__ */ d(n, {
|
|
56
56
|
size: "md",
|
|
57
57
|
className: "aivex:shrink-0",
|
|
58
|
-
...
|
|
58
|
+
...r,
|
|
59
59
|
children: t
|
|
60
60
|
});
|
|
61
61
|
}
|
|
@@ -97,18 +97,18 @@ function x({ tertiaryButton: e, secondaryButton: t, primaryButton: n, ref: r, ..
|
|
|
97
97
|
})]
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
|
-
function S({ button: e, variant: t, color: n, className:
|
|
100
|
+
function S({ button: e, variant: t, color: n, className: r }) {
|
|
101
101
|
let { children: a, ...o } = e;
|
|
102
|
-
return /* @__PURE__ */ d(
|
|
102
|
+
return /* @__PURE__ */ d(i, {
|
|
103
103
|
variant: t,
|
|
104
104
|
color: n,
|
|
105
105
|
size: "lg",
|
|
106
|
-
className:
|
|
106
|
+
className: r,
|
|
107
107
|
...o,
|
|
108
108
|
children: a
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
|
-
function C({ open: e, defaultOpen:
|
|
111
|
+
function C({ open: e, defaultOpen: n, onOpenChange: i, children: s, size: c = "md", closeOnInteractOutside: l = !0, initialFocus: _, finalFocus: v }) {
|
|
112
112
|
let y = u(null), b = o({
|
|
113
113
|
open: e,
|
|
114
114
|
modal: !0,
|
|
@@ -118,10 +118,10 @@ function C({ open: e, defaultOpen: r, onOpenChange: i, children: s, size: c = "m
|
|
|
118
118
|
});
|
|
119
119
|
return /* @__PURE__ */ d(p.Root, {
|
|
120
120
|
open: e,
|
|
121
|
-
defaultOpen:
|
|
121
|
+
defaultOpen: n,
|
|
122
122
|
onOpenChange: i,
|
|
123
123
|
disablePointerDismissal: !l,
|
|
124
|
-
children: /* @__PURE__ */ d(
|
|
124
|
+
children: /* @__PURE__ */ d(r, { children: /* @__PURE__ */ f(p.Portal, { children: [/* @__PURE__ */ d(p.Backdrop, {
|
|
125
125
|
forceRender: !0,
|
|
126
126
|
className: a({ variant: "dim" })
|
|
127
127
|
}), /* @__PURE__ */ d(p.Popup, {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils.cjs`),t=require(`../../utils/useControllableState.cjs`),n=require(`../
|
|
1
|
+
"use client";"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils.cjs`),t=require(`../../utils/useControllableState.cjs`),n=require(`../Field/FieldStateContext.cjs`),r=require(`../InputBase/InputBase.cjs`),i=require(`../InputBase/useInputState.cjs`);let a=require(`react/jsx-runtime`),o=require(`@base-ui/react/number-field`);var s={left:`aivex:text-left`,center:`aivex:text-center`,right:`aivex:text-right`};function c({value:c,defaultValue:l,onValueChange:u,onValueCommitted:d,min:f,max:p,step:m,largeStep:h,format:g,locale:_,size:v=`md`,error:y,align:b=`left`,startContent:x,endContent:S,disabled:C,readOnly:w,required:T,name:E,id:D,className:O,onFocus:k,onBlur:A,ref:j,...M}){let N=i.useInputFocus({onFocus:k,onBlur:A}),P=n.useFieldState(),[F,I]=t.useControllableState({value:c,defaultValue:l??null,onChange:u}),L=i.resolveInputError(y,M[`aria-invalid`])||P.invalid,R=!!C||P.disabled,z={id:D,name:E,min:f,max:p,step:m,largeStep:h,format:g,locale:_,disabled:C,readOnly:w,required:T,onValueChange:e=>I(e),onValueCommitted:d?e=>d(e):void 0};return(0,a.jsx)(o.NumberField.Root,{...z,...c===void 0?{defaultValue:l}:{value:c},className:`aivex:w-full`,children:(0,a.jsx)(r.InputBase,{error:L,disabled:R,focused:N.focused,filled:F!==null,size:v,layout:`inline`,startContent:x,endContent:S,children:(0,a.jsx)(o.NumberField.Input,{ref:j,className:e.cn(`aivex:m-0 aivex:w-full aivex:min-w-0 aivex:appearance-none aivex:border-0 aivex:bg-transparent aivex:p-0 aivex:text-text-primary aivex:placeholder:text-text-tertiary aivex:outline-none aivex:tabular-nums`,v===`sm`?`aivex:text-body-md-regular`:`aivex:text-body-lg-regular`,s[b],O),onFocus:N.onFocus,onBlur:N.onBlur,...M})})})}exports.NumberField=c;
|
|
2
2
|
//# sourceMappingURL=NumberField.cjs.map
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
import { cn as e } from "../../utils.js";
|
|
4
4
|
import { useControllableState as t } from "../../utils/useControllableState.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { useFieldState as n } from "../Field/FieldStateContext.js";
|
|
6
|
+
import { InputBase as r } from "../InputBase/InputBase.js";
|
|
7
|
+
import { resolveInputError as i, useInputFocus as a } from "../InputBase/useInputState.js";
|
|
8
8
|
import { jsx as o } from "react/jsx-runtime";
|
|
9
9
|
import { NumberField as s } from "@base-ui/react/number-field";
|
|
10
10
|
//#region src/components/NumberField/NumberField.tsx
|
|
@@ -14,14 +14,14 @@ var c = {
|
|
|
14
14
|
right: "aivex:text-right"
|
|
15
15
|
};
|
|
16
16
|
function l({ value: l, defaultValue: u, onValueChange: d, onValueCommitted: f, min: p, max: m, step: h, largeStep: g, format: _, locale: v, size: y = "md", error: b, align: x = "left", startContent: S, endContent: C, disabled: w, readOnly: T, required: E, name: D, id: O, className: k, onFocus: A, onBlur: j, ref: M, ...N }) {
|
|
17
|
-
let P =
|
|
17
|
+
let P = a({
|
|
18
18
|
onFocus: A,
|
|
19
19
|
onBlur: j
|
|
20
|
-
}), F =
|
|
20
|
+
}), F = n(), [I, L] = t({
|
|
21
21
|
value: l,
|
|
22
22
|
defaultValue: u ?? null,
|
|
23
23
|
onChange: d
|
|
24
|
-
}), R =
|
|
24
|
+
}), R = i(b, N["aria-invalid"]) || F.invalid, z = !!w || F.disabled, B = {
|
|
25
25
|
id: O,
|
|
26
26
|
name: D,
|
|
27
27
|
min: p,
|
|
@@ -40,7 +40,7 @@ function l({ value: l, defaultValue: u, onValueChange: d, onValueCommitted: f, m
|
|
|
40
40
|
...B,
|
|
41
41
|
...l === void 0 ? { defaultValue: u } : { value: l },
|
|
42
42
|
className: "aivex:w-full",
|
|
43
|
-
children: /* @__PURE__ */ o(
|
|
43
|
+
children: /* @__PURE__ */ o(r, {
|
|
44
44
|
error: R,
|
|
45
45
|
disabled: z,
|
|
46
46
|
focused: P.focused,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.cjs","names":[],"sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["\"use client\";\n\nimport { Popover as PopoverPrimitive } from \"@base-ui/react/popover\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { PortalEventBoundary } from \"@/utils/PortalEventBoundary\";\nimport { type PopupPositioningProps, splitPositioningProps } from \"@/utils/popupPositioning\";\n\n// ─── Content shell ─────────────────────────────────────────────────────────────\n\n/**\n * Popover 계열 카드의 공통 골격 — 세로 레이아웃·최대 높이·패딩·열림/닫힘\n * 애니메이션. Popover와 Coachmark가 함께 쓰고 폭·표면(배경·테두리)만 각자 정한다.\n */\nconst popoverContentBaseClassName = cn(\n \"aivex:flex aivex:flex-col aivex:gap-lg aivex:max-h-[448px] aivex:p-xl\",\n \"aivex:rounded-xl aivex:shadow-md\",\n \"aivex:outline-none\",\n \"aivex:data-[open]:animate-in aivex:data-[closed]:animate-out\",\n \"aivex:data-[closed]:fade-out-0 aivex:data-[open]:fade-in-0\",\n \"aivex:data-[closed]:zoom-out-95 aivex:data-[open]:zoom-in-95\",\n);\n\n/** 위치를 잡는 바깥 요소(Positioner)의 클래스 — 쌓임 순서는 여기서 정한다. */\nconst popoverPositionerClassName = \"aivex:z-(--aivex-z-dropdown) aivex:outline-none\";\n\n// 폭 277px은 Figma Popover-Dropdown 사양이다(Coachmark의 Popover-Bubble은 280px).\nconst contentClassName = cn(\n popoverContentBaseClassName,\n \"aivex:w-[277px]\",\n // 포털로 body에 붙으므로 글자색을 호스트 body에서 상속받지 않게 배경과 짝으로 지정한다.\n \"aivex:bg-bg-primary aivex:text-text-primary aivex:border aivex:border-border-subtle aivex:overflow-clip\",\n);\n\n// ─── Root ─────────────────────────────────────────────────────────────────────\n\n/** Popover 루트 props — open·defaultOpen·onOpenChange(open, details)·modal. */\ntype PopoverRootProps = PopoverPrimitive.Root.Props;\n\nfunction PopoverRoot(props: PopoverRootProps) {\n return <PopoverPrimitive.Root {...props} />;\n}\n\n// ─── Trigger ──────────────────────────────────────────────────────────────────\n\n/** Popover.Trigger props — button 속성 + `render`. */\ntype PopoverTriggerProps = PopoverPrimitive.Trigger.Props & {\n ref?: Ref<HTMLButtonElement>;\n};\n\n/** `render`로 ToggleButton 등 임의의 버튼을 트리거로 쓴다. 버튼이 아닌 요소면 `nativeButton={false}`를 준다. */\nfunction PopoverTrigger({ ref, ...props }: PopoverTriggerProps) {\n return <PopoverPrimitive.Trigger ref={ref} {...props} />;\n}\n\n// ─── Close ────────────────────────────────────────────────────────────────────\n\n/** Popover.Close props — button 속성 + `render`. */\ntype PopoverCloseProps = PopoverPrimitive.Close.Props & {\n ref?: Ref<HTMLButtonElement>;\n};\n\n/** `render`로 하단 버튼을 넘기면 그 버튼을 눌렀을 때 팝오버가 닫힌다. */\nfunction PopoverClose({ ref, ...props }: PopoverCloseProps) {\n return <PopoverPrimitive.Close ref={ref} {...props} />;\n}\n\n// ─── Content ──────────────────────────────────────────────────────────────────\n\n/**\n * Popover.Content props — 카드(div) 속성, 위치 props(side·align·sideOffset·anchor 등),\n * 포커스 이동(initialFocus·finalFocus), 포털 대상.\n */\ntype PopoverContentProps = Omit<PopoverPrimitive.Popup.Props, \"className\"> &\n PopupPositioningProps & {\n className?: string;\n /** 포털 대상. 생략하면 document.body — Shadow DOM 안에서는 그 루트 안의 요소를 넘긴다. */\n container?: PopoverPrimitive.Portal.Props[\"container\"];\n /**\n * 닫혀 있을 때도 DOM에 남겨 둔다.\n * @default false\n */\n keepMounted?: boolean;\n ref?: Ref<HTMLDivElement>;\n };\n\n/**\n * 포털로 띄우는 277px 폭 카드. 기본 sideOffset 8, align \"start\".\n * 안에 Popover.Title·Body·Footer를 순서대로 둔다.\n * 트리거가 아닌 요소를 기준으로 띄우려면 `anchor`에 그 요소나 ref를 넘긴다.\n */\nfunction PopoverContent({ className, container, keepMounted, ref, ...props }: PopoverContentProps) {\n const [{ sideOffset = 8, align = \"start\", ...positioning }, popupProps] =\n splitPositioningProps(props);\n\n return (\n <PortalEventBoundary>\n <PopoverPrimitive.Portal container={container} keepMounted={keepMounted}>\n <PopoverPrimitive.Positioner\n sideOffset={sideOffset}\n align={align}\n className={popoverPositionerClassName}\n {...positioning}\n >\n <PopoverPrimitive.Popup\n ref={ref}\n className={cn(contentClassName, className)}\n {...popupProps}\n />\n </PopoverPrimitive.Positioner>\n </PopoverPrimitive.Portal>\n </PortalEventBoundary>\n );\n}\n\n// ─── Title ────────────────────────────────────────────────────────────────────\n\n/** Popover.Title props — div 속성. */\ntype PopoverTitleProps = ComponentPropsWithoutRef<\"div\"> & {\n ref?: Ref<HTMLDivElement>;\n};\n\n/** 카드 상단 한 줄 제목(넘치면 말줄임). 시각적 제목이며 aria 연결은 하지 않는다. */\nfunction PopoverTitle({ className, ref, ...props }: PopoverTitleProps) {\n return (\n <div\n ref={ref}\n className={cn(\n \"aivex:w-full aivex:px-xs aivex:text-body-md-medium aivex:text-text-primary aivex:truncate\",\n className,\n )}\n {...props}\n />\n );\n}\n\n// ─── Body (ItemArea) ────────────────────────────────────────────────────────────\n\n/** Popover.Body props — div 속성. */\ntype PopoverBodyProps = ComponentPropsWithoutRef<\"div\"> & {\n ref?: Ref<HTMLDivElement>;\n};\n\n/** 검색창·목록 등 자유롭게 들어가는 스크롤 영역입니다. */\nfunction PopoverBody({ className, ref, ...props }: PopoverBodyProps) {\n return (\n <div\n ref={ref}\n className={cn(\n \"aivex:flex aivex:min-h-0 aivex:w-full aivex:flex-1 aivex:flex-col aivex:gap-md aivex:overflow-y-auto\",\n className,\n )}\n {...props}\n />\n );\n}\n\n// ─── Footer (BtnContainer) ──────────────────────────────────────────────────────\n\n/** Popover.Footer props — div 속성 + 좌측 슬롯. */\ninterface PopoverFooterProps extends ComponentPropsWithoutRef<\"div\"> {\n /** 좌측에 넓게 붙는 영역(예: 옵션 tertiary 버튼). 지정 시 나머지 버튼은 우측 정렬됩니다. */\n start?: ReactNode;\n ref?: Ref<HTMLDivElement>;\n}\n\n/** 하단 버튼 줄 — children은 우측 정렬, start는 좌측에 붙는다. */\nfunction PopoverFooter({ className, start, children, ref, ...props }: PopoverFooterProps) {\n return (\n <div\n ref={ref}\n className={cn(\n \"aivex:flex aivex:w-full aivex:items-center aivex:justify-end aivex:gap-md\",\n className,\n )}\n {...props}\n >\n {start && (\n <div className=\"aivex:flex aivex:min-w-0 aivex:flex-1 aivex:flex-col aivex:items-start aivex:justify-center\">\n {start}\n </div>\n )}\n {children}\n </div>\n );\n}\n\n// ─── Compound export ──────────────────────────────────────────────────────────\n\n/**\n * 트리거 옆에 뜨는 비모달 카드(필터·옵션 선택 등)를 만드는 컴파운드 컴포넌트.\n *\n * 버튼을 눌러 검색·체크 목록·적용 버튼 같은 상호작용 내용을 띄울 때 쓴다. 호버로 짧은 설명만\n * 보이면 Tooltip, 화면을 막고 작업을 받아야 하면 Modal을 쓴다. open/onOpenChange로 제어하거나\n * 비제어로 쓰며, 바깥 클릭·Esc로 닫힌다. 버튼으로 닫으려면 Popover.Close의 render로 그 버튼을 넘긴다.\n *\n * @example\n * ```tsx\n * import { Button, Popover, ToggleButton } from \"@aivex/ui\";\n *\n * <Popover>\n * <Popover.Trigger render={<ToggleButton>필터</ToggleButton>} />\n * <Popover.Content>\n * <Popover.Title>상태 필터</Popover.Title>\n * <Popover.Body>…</Popover.Body>\n * <Popover.Footer start={<Button variant=\"ghost\">초기화</Button>}>\n * <Popover.Close render={<Button variant=\"solid\" color=\"secondary\">취소</Button>} />\n * <Button onClick={apply}>적용하기</Button>\n * </Popover.Footer>\n * </Popover.Content>\n * </Popover>\n * ```\n */\nconst Popover = Object.assign(PopoverRoot, {\n Trigger: PopoverTrigger,\n Close: PopoverClose,\n Content: PopoverContent,\n Title: PopoverTitle,\n Body: PopoverBody,\n Footer: PopoverFooter,\n});\n\nexport type {\n PopoverBodyProps,\n PopoverCloseProps,\n PopoverContentProps,\n PopoverFooterProps,\n PopoverRootProps,\n PopoverTitleProps,\n PopoverTriggerProps,\n};\nexport { Popover, popoverContentBaseClassName, popoverPositionerClassName };\n"],"mappings":"mRAcA,IAAM,EAA8B,EAAA,GAClC,wEACA,mCACA,qBACA,+DACA,6DACA,+DACD,CAGK,EAA6B,kDAG7B,EAAmB,EAAA,GACvB,EACA,kBAEA,0GACD,CAOD,SAAS,EAAY,EAAyB,CAC5C,OAAO,EAAA,EAAA,KAAC,EAAA,QAAiB,KAAlB,CAAuB,GAAI,EAAS,CAAA,CAW7C,SAAS,EAAe,CAAE,MAAK,GAAG,GAA8B,CAC9D,OAAO,EAAA,EAAA,KAAC,EAAA,QAAiB,QAAlB,CAA+B,MAAK,GAAI,EAAS,CAAA,CAW1D,SAAS,EAAa,CAAE,MAAK,GAAG,GAA4B,CAC1D,OAAO,EAAA,EAAA,KAAC,EAAA,QAAiB,MAAlB,CAA6B,MAAK,GAAI,EAAS,CAAA,
|
|
1
|
+
{"version":3,"file":"Popover.cjs","names":[],"sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["\"use client\";\n\nimport { Popover as PopoverPrimitive } from \"@base-ui/react/popover\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { PortalEventBoundary } from \"@/utils/PortalEventBoundary\";\nimport { type PopupPositioningProps, splitPositioningProps } from \"@/utils/popupPositioning\";\n\n// ─── Content shell ─────────────────────────────────────────────────────────────\n\n/**\n * Popover 계열 카드의 공통 골격 — 세로 레이아웃·최대 높이·패딩·열림/닫힘\n * 애니메이션. Popover와 Coachmark가 함께 쓰고 폭·표면(배경·테두리)만 각자 정한다.\n */\nconst popoverContentBaseClassName = cn(\n \"aivex:flex aivex:flex-col aivex:gap-lg aivex:max-h-[448px] aivex:p-xl\",\n \"aivex:rounded-xl aivex:shadow-md\",\n \"aivex:outline-none\",\n \"aivex:data-[open]:animate-in aivex:data-[closed]:animate-out\",\n \"aivex:data-[closed]:fade-out-0 aivex:data-[open]:fade-in-0\",\n \"aivex:data-[closed]:zoom-out-95 aivex:data-[open]:zoom-in-95\",\n);\n\n/** 위치를 잡는 바깥 요소(Positioner)의 클래스 — 쌓임 순서는 여기서 정한다. */\nconst popoverPositionerClassName = \"aivex:z-(--aivex-z-dropdown) aivex:outline-none\";\n\n// 폭 277px은 Figma Popover-Dropdown 사양이다(Coachmark의 Popover-Bubble은 280px).\nconst contentClassName = cn(\n popoverContentBaseClassName,\n \"aivex:w-[277px]\",\n // 포털로 body에 붙으므로 글자색을 호스트 body에서 상속받지 않게 배경과 짝으로 지정한다.\n \"aivex:bg-bg-primary aivex:text-text-primary aivex:border aivex:border-border-subtle aivex:overflow-clip\",\n);\n\n// ─── Root ─────────────────────────────────────────────────────────────────────\n\n/** Popover 루트 props — open·defaultOpen·onOpenChange(open, details)·modal. */\ntype PopoverRootProps = PopoverPrimitive.Root.Props;\n\nfunction PopoverRoot(props: PopoverRootProps) {\n return <PopoverPrimitive.Root {...props} />;\n}\n\n// ─── Trigger ──────────────────────────────────────────────────────────────────\n\n/** Popover.Trigger props — button 속성 + `render`. */\ntype PopoverTriggerProps = PopoverPrimitive.Trigger.Props & {\n ref?: Ref<HTMLButtonElement>;\n};\n\n/** `render`로 ToggleButton 등 임의의 버튼을 트리거로 쓴다. 버튼이 아닌 요소면 `nativeButton={false}`를 준다. */\nfunction PopoverTrigger({ ref, ...props }: PopoverTriggerProps) {\n return <PopoverPrimitive.Trigger ref={ref} {...props} />;\n}\n\n// ─── Close ────────────────────────────────────────────────────────────────────\n\n/** Popover.Close props — button 속성 + `render`. */\ntype PopoverCloseProps = PopoverPrimitive.Close.Props & {\n ref?: Ref<HTMLButtonElement>;\n};\n\n/** `render`로 하단 버튼을 넘기면 그 버튼을 눌렀을 때 팝오버가 닫힌다. */\nfunction PopoverClose({ ref, ...props }: PopoverCloseProps) {\n return <PopoverPrimitive.Close ref={ref} {...props} />;\n}\n\n// ─── Content ──────────────────────────────────────────────────────────────────\n\n/**\n * Popover.Content props — 카드(div) 속성, 위치 props(side·align·sideOffset·anchor 등),\n * 포커스 이동(initialFocus·finalFocus), 포털 대상.\n */\ntype PopoverContentProps = Omit<PopoverPrimitive.Popup.Props, \"className\"> &\n PopupPositioningProps & {\n className?: string;\n /** 포털 대상. 생략하면 document.body — Shadow DOM 안에서는 그 루트 안의 요소를 넘긴다. */\n container?: PopoverPrimitive.Portal.Props[\"container\"];\n /**\n * 닫혀 있을 때도 DOM에 남겨 둔다.\n * @default false\n */\n keepMounted?: boolean;\n ref?: Ref<HTMLDivElement>;\n };\n\n/**\n * 포털로 띄우는 277px 폭 카드. 기본 sideOffset 8, align \"start\".\n * 안에 Popover.Title·Body·Footer를 순서대로 둔다.\n * 트리거가 아닌 요소를 기준으로 띄우려면 `anchor`에 그 요소나 ref를 넘긴다.\n *\n * `anchor`는 위치만 정한다. Esc·포커스 이동은 Trigger와 팝오버 자신에만 걸리므로, 입력을 누르면\n * 그 아래에 뜨는 팝오버(달력 등)는 그 입력을 `Popover.Trigger`의 `render`로 넘긴다\n * (`nativeButton={false}`). 트리거 없이 포커스를 입력에 둔 채 `anchor`만으로 띄우면, 모달 안에서\n * Esc가 팝오버를 건너뛰어 모달을 닫는다. 입력하면서 제안 목록을 고르는 형태는 Autocomplete를 쓴다.\n */\nfunction PopoverContent({ className, container, keepMounted, ref, ...props }: PopoverContentProps) {\n const [{ sideOffset = 8, align = \"start\", ...positioning }, popupProps] =\n splitPositioningProps(props);\n\n return (\n <PortalEventBoundary>\n <PopoverPrimitive.Portal container={container} keepMounted={keepMounted}>\n <PopoverPrimitive.Positioner\n sideOffset={sideOffset}\n align={align}\n className={popoverPositionerClassName}\n {...positioning}\n >\n <PopoverPrimitive.Popup\n ref={ref}\n className={cn(contentClassName, className)}\n {...popupProps}\n />\n </PopoverPrimitive.Positioner>\n </PopoverPrimitive.Portal>\n </PortalEventBoundary>\n );\n}\n\n// ─── Title ────────────────────────────────────────────────────────────────────\n\n/** Popover.Title props — div 속성. */\ntype PopoverTitleProps = ComponentPropsWithoutRef<\"div\"> & {\n ref?: Ref<HTMLDivElement>;\n};\n\n/** 카드 상단 한 줄 제목(넘치면 말줄임). 시각적 제목이며 aria 연결은 하지 않는다. */\nfunction PopoverTitle({ className, ref, ...props }: PopoverTitleProps) {\n return (\n <div\n ref={ref}\n className={cn(\n \"aivex:w-full aivex:px-xs aivex:text-body-md-medium aivex:text-text-primary aivex:truncate\",\n className,\n )}\n {...props}\n />\n );\n}\n\n// ─── Body (ItemArea) ────────────────────────────────────────────────────────────\n\n/** Popover.Body props — div 속성. */\ntype PopoverBodyProps = ComponentPropsWithoutRef<\"div\"> & {\n ref?: Ref<HTMLDivElement>;\n};\n\n/** 검색창·목록 등 자유롭게 들어가는 스크롤 영역입니다. */\nfunction PopoverBody({ className, ref, ...props }: PopoverBodyProps) {\n return (\n <div\n ref={ref}\n className={cn(\n \"aivex:flex aivex:min-h-0 aivex:w-full aivex:flex-1 aivex:flex-col aivex:gap-md aivex:overflow-y-auto\",\n className,\n )}\n {...props}\n />\n );\n}\n\n// ─── Footer (BtnContainer) ──────────────────────────────────────────────────────\n\n/** Popover.Footer props — div 속성 + 좌측 슬롯. */\ninterface PopoverFooterProps extends ComponentPropsWithoutRef<\"div\"> {\n /** 좌측에 넓게 붙는 영역(예: 옵션 tertiary 버튼). 지정 시 나머지 버튼은 우측 정렬됩니다. */\n start?: ReactNode;\n ref?: Ref<HTMLDivElement>;\n}\n\n/** 하단 버튼 줄 — children은 우측 정렬, start는 좌측에 붙는다. */\nfunction PopoverFooter({ className, start, children, ref, ...props }: PopoverFooterProps) {\n return (\n <div\n ref={ref}\n className={cn(\n \"aivex:flex aivex:w-full aivex:items-center aivex:justify-end aivex:gap-md\",\n className,\n )}\n {...props}\n >\n {start && (\n <div className=\"aivex:flex aivex:min-w-0 aivex:flex-1 aivex:flex-col aivex:items-start aivex:justify-center\">\n {start}\n </div>\n )}\n {children}\n </div>\n );\n}\n\n// ─── Compound export ──────────────────────────────────────────────────────────\n\n/**\n * 트리거 옆에 뜨는 비모달 카드(필터·옵션 선택 등)를 만드는 컴파운드 컴포넌트.\n *\n * 버튼을 눌러 검색·체크 목록·적용 버튼 같은 상호작용 내용을 띄울 때 쓴다. 호버로 짧은 설명만\n * 보이면 Tooltip, 화면을 막고 작업을 받아야 하면 Modal을 쓴다. open/onOpenChange로 제어하거나\n * 비제어로 쓰며, 바깥 클릭·Esc로 닫힌다. 버튼으로 닫으려면 Popover.Close의 render로 그 버튼을 넘긴다.\n *\n * @example\n * ```tsx\n * import { Button, Popover, ToggleButton } from \"@aivex/ui\";\n *\n * <Popover>\n * <Popover.Trigger render={<ToggleButton>필터</ToggleButton>} />\n * <Popover.Content>\n * <Popover.Title>상태 필터</Popover.Title>\n * <Popover.Body>…</Popover.Body>\n * <Popover.Footer start={<Button variant=\"ghost\">초기화</Button>}>\n * <Popover.Close render={<Button variant=\"solid\" color=\"secondary\">취소</Button>} />\n * <Button onClick={apply}>적용하기</Button>\n * </Popover.Footer>\n * </Popover.Content>\n * </Popover>\n * ```\n */\nconst Popover = Object.assign(PopoverRoot, {\n Trigger: PopoverTrigger,\n Close: PopoverClose,\n Content: PopoverContent,\n Title: PopoverTitle,\n Body: PopoverBody,\n Footer: PopoverFooter,\n});\n\nexport type {\n PopoverBodyProps,\n PopoverCloseProps,\n PopoverContentProps,\n PopoverFooterProps,\n PopoverRootProps,\n PopoverTitleProps,\n PopoverTriggerProps,\n};\nexport { Popover, popoverContentBaseClassName, popoverPositionerClassName };\n"],"mappings":"mRAcA,IAAM,EAA8B,EAAA,GAClC,wEACA,mCACA,qBACA,+DACA,6DACA,+DACD,CAGK,EAA6B,kDAG7B,EAAmB,EAAA,GACvB,EACA,kBAEA,0GACD,CAOD,SAAS,EAAY,EAAyB,CAC5C,OAAO,EAAA,EAAA,KAAC,EAAA,QAAiB,KAAlB,CAAuB,GAAI,EAAS,CAAA,CAW7C,SAAS,EAAe,CAAE,MAAK,GAAG,GAA8B,CAC9D,OAAO,EAAA,EAAA,KAAC,EAAA,QAAiB,QAAlB,CAA+B,MAAK,GAAI,EAAS,CAAA,CAW1D,SAAS,EAAa,CAAE,MAAK,GAAG,GAA4B,CAC1D,OAAO,EAAA,EAAA,KAAC,EAAA,QAAiB,MAAlB,CAA6B,MAAK,GAAI,EAAS,CAAA,CAgCxD,SAAS,EAAe,CAAE,YAAW,YAAW,cAAa,MAAK,GAAG,GAA8B,CACjG,GAAM,CAAC,CAAE,aAAa,EAAG,QAAQ,QAAS,GAAG,GAAe,GAC1D,EAAA,sBAAsB,EAAM,CAE9B,OACE,EAAA,EAAA,KAAC,EAAA,oBAAD,CAAA,UACE,EAAA,EAAA,KAAC,EAAA,QAAiB,OAAlB,CAAoC,YAAwB,wBAC1D,EAAA,EAAA,KAAC,EAAA,QAAiB,WAAlB,CACc,aACL,QACP,UAAW,EACX,GAAI,YAEJ,EAAA,EAAA,KAAC,EAAA,QAAiB,MAAlB,CACO,MACL,UAAW,EAAA,GAAG,EAAkB,EAAU,CAC1C,GAAI,EACJ,CAAA,CAC0B,CAAA,CACN,CAAA,CACN,CAAA,CAY1B,SAAS,EAAa,CAAE,YAAW,MAAK,GAAG,GAA4B,CACrE,OACE,EAAA,EAAA,KAAC,MAAD,CACO,MACL,UAAW,EAAA,GACT,4FACA,EACD,CACD,GAAI,EACJ,CAAA,CAYN,SAAS,EAAY,CAAE,YAAW,MAAK,GAAG,GAA2B,CACnE,OACE,EAAA,EAAA,KAAC,MAAD,CACO,MACL,UAAW,EAAA,GACT,uGACA,EACD,CACD,GAAI,EACJ,CAAA,CAcN,SAAS,EAAc,CAAE,YAAW,QAAO,WAAU,MAAK,GAAG,GAA6B,CACxF,OACE,EAAA,EAAA,MAAC,MAAD,CACO,MACL,UAAW,EAAA,GACT,4EACA,EACD,CACD,GAAI,WANN,CAQG,IACC,EAAA,EAAA,KAAC,MAAD,CAAK,UAAU,uGACZ,EACG,CAAA,CAEP,EACG,GA8BV,IAAM,EAAU,OAAO,OAAO,EAAa,CACzC,QAAS,EACT,MAAO,EACP,QAAS,EACT,MAAO,EACP,KAAM,EACN,OAAQ,EACT,CAAC"}
|
|
@@ -42,6 +42,11 @@ type PopoverContentProps = Omit<PopoverPrimitive.Popup.Props, "className"> & Pop
|
|
|
42
42
|
* 포털로 띄우는 277px 폭 카드. 기본 sideOffset 8, align "start".
|
|
43
43
|
* 안에 Popover.Title·Body·Footer를 순서대로 둔다.
|
|
44
44
|
* 트리거가 아닌 요소를 기준으로 띄우려면 `anchor`에 그 요소나 ref를 넘긴다.
|
|
45
|
+
*
|
|
46
|
+
* `anchor`는 위치만 정한다. Esc·포커스 이동은 Trigger와 팝오버 자신에만 걸리므로, 입력을 누르면
|
|
47
|
+
* 그 아래에 뜨는 팝오버(달력 등)는 그 입력을 `Popover.Trigger`의 `render`로 넘긴다
|
|
48
|
+
* (`nativeButton={false}`). 트리거 없이 포커스를 입력에 둔 채 `anchor`만으로 띄우면, 모달 안에서
|
|
49
|
+
* Esc가 팝오버를 건너뛰어 모달을 닫는다. 입력하면서 제안 목록을 고르는 형태는 Autocomplete를 쓴다.
|
|
45
50
|
*/
|
|
46
51
|
declare function PopoverContent({ className, container, keepMounted, ref, ...props }: PopoverContentProps): import("react/jsx-runtime").JSX.Element;
|
|
47
52
|
/** Popover.Title props — div 속성. */
|
|
@@ -42,6 +42,11 @@ type PopoverContentProps = Omit<PopoverPrimitive.Popup.Props, "className"> & Pop
|
|
|
42
42
|
* 포털로 띄우는 277px 폭 카드. 기본 sideOffset 8, align "start".
|
|
43
43
|
* 안에 Popover.Title·Body·Footer를 순서대로 둔다.
|
|
44
44
|
* 트리거가 아닌 요소를 기준으로 띄우려면 `anchor`에 그 요소나 ref를 넘긴다.
|
|
45
|
+
*
|
|
46
|
+
* `anchor`는 위치만 정한다. Esc·포커스 이동은 Trigger와 팝오버 자신에만 걸리므로, 입력을 누르면
|
|
47
|
+
* 그 아래에 뜨는 팝오버(달력 등)는 그 입력을 `Popover.Trigger`의 `render`로 넘긴다
|
|
48
|
+
* (`nativeButton={false}`). 트리거 없이 포커스를 입력에 둔 채 `anchor`만으로 띄우면, 모달 안에서
|
|
49
|
+
* Esc가 팝오버를 건너뛰어 모달을 닫는다. 입력하면서 제안 목록을 고르는 형태는 Autocomplete를 쓴다.
|
|
45
50
|
*/
|
|
46
51
|
declare function PopoverContent({ className, container, keepMounted, ref, ...props }: PopoverContentProps): import("react/jsx-runtime").JSX.Element;
|
|
47
52
|
/** Popover.Title props — div 속성. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.js","names":[],"sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["\"use client\";\n\nimport { Popover as PopoverPrimitive } from \"@base-ui/react/popover\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { PortalEventBoundary } from \"@/utils/PortalEventBoundary\";\nimport { type PopupPositioningProps, splitPositioningProps } from \"@/utils/popupPositioning\";\n\n// ─── Content shell ─────────────────────────────────────────────────────────────\n\n/**\n * Popover 계열 카드의 공통 골격 — 세로 레이아웃·최대 높이·패딩·열림/닫힘\n * 애니메이션. Popover와 Coachmark가 함께 쓰고 폭·표면(배경·테두리)만 각자 정한다.\n */\nconst popoverContentBaseClassName = cn(\n \"aivex:flex aivex:flex-col aivex:gap-lg aivex:max-h-[448px] aivex:p-xl\",\n \"aivex:rounded-xl aivex:shadow-md\",\n \"aivex:outline-none\",\n \"aivex:data-[open]:animate-in aivex:data-[closed]:animate-out\",\n \"aivex:data-[closed]:fade-out-0 aivex:data-[open]:fade-in-0\",\n \"aivex:data-[closed]:zoom-out-95 aivex:data-[open]:zoom-in-95\",\n);\n\n/** 위치를 잡는 바깥 요소(Positioner)의 클래스 — 쌓임 순서는 여기서 정한다. */\nconst popoverPositionerClassName = \"aivex:z-(--aivex-z-dropdown) aivex:outline-none\";\n\n// 폭 277px은 Figma Popover-Dropdown 사양이다(Coachmark의 Popover-Bubble은 280px).\nconst contentClassName = cn(\n popoverContentBaseClassName,\n \"aivex:w-[277px]\",\n // 포털로 body에 붙으므로 글자색을 호스트 body에서 상속받지 않게 배경과 짝으로 지정한다.\n \"aivex:bg-bg-primary aivex:text-text-primary aivex:border aivex:border-border-subtle aivex:overflow-clip\",\n);\n\n// ─── Root ─────────────────────────────────────────────────────────────────────\n\n/** Popover 루트 props — open·defaultOpen·onOpenChange(open, details)·modal. */\ntype PopoverRootProps = PopoverPrimitive.Root.Props;\n\nfunction PopoverRoot(props: PopoverRootProps) {\n return <PopoverPrimitive.Root {...props} />;\n}\n\n// ─── Trigger ──────────────────────────────────────────────────────────────────\n\n/** Popover.Trigger props — button 속성 + `render`. */\ntype PopoverTriggerProps = PopoverPrimitive.Trigger.Props & {\n ref?: Ref<HTMLButtonElement>;\n};\n\n/** `render`로 ToggleButton 등 임의의 버튼을 트리거로 쓴다. 버튼이 아닌 요소면 `nativeButton={false}`를 준다. */\nfunction PopoverTrigger({ ref, ...props }: PopoverTriggerProps) {\n return <PopoverPrimitive.Trigger ref={ref} {...props} />;\n}\n\n// ─── Close ────────────────────────────────────────────────────────────────────\n\n/** Popover.Close props — button 속성 + `render`. */\ntype PopoverCloseProps = PopoverPrimitive.Close.Props & {\n ref?: Ref<HTMLButtonElement>;\n};\n\n/** `render`로 하단 버튼을 넘기면 그 버튼을 눌렀을 때 팝오버가 닫힌다. */\nfunction PopoverClose({ ref, ...props }: PopoverCloseProps) {\n return <PopoverPrimitive.Close ref={ref} {...props} />;\n}\n\n// ─── Content ──────────────────────────────────────────────────────────────────\n\n/**\n * Popover.Content props — 카드(div) 속성, 위치 props(side·align·sideOffset·anchor 등),\n * 포커스 이동(initialFocus·finalFocus), 포털 대상.\n */\ntype PopoverContentProps = Omit<PopoverPrimitive.Popup.Props, \"className\"> &\n PopupPositioningProps & {\n className?: string;\n /** 포털 대상. 생략하면 document.body — Shadow DOM 안에서는 그 루트 안의 요소를 넘긴다. */\n container?: PopoverPrimitive.Portal.Props[\"container\"];\n /**\n * 닫혀 있을 때도 DOM에 남겨 둔다.\n * @default false\n */\n keepMounted?: boolean;\n ref?: Ref<HTMLDivElement>;\n };\n\n/**\n * 포털로 띄우는 277px 폭 카드. 기본 sideOffset 8, align \"start\".\n * 안에 Popover.Title·Body·Footer를 순서대로 둔다.\n * 트리거가 아닌 요소를 기준으로 띄우려면 `anchor`에 그 요소나 ref를 넘긴다.\n */\nfunction PopoverContent({ className, container, keepMounted, ref, ...props }: PopoverContentProps) {\n const [{ sideOffset = 8, align = \"start\", ...positioning }, popupProps] =\n splitPositioningProps(props);\n\n return (\n <PortalEventBoundary>\n <PopoverPrimitive.Portal container={container} keepMounted={keepMounted}>\n <PopoverPrimitive.Positioner\n sideOffset={sideOffset}\n align={align}\n className={popoverPositionerClassName}\n {...positioning}\n >\n <PopoverPrimitive.Popup\n ref={ref}\n className={cn(contentClassName, className)}\n {...popupProps}\n />\n </PopoverPrimitive.Positioner>\n </PopoverPrimitive.Portal>\n </PortalEventBoundary>\n );\n}\n\n// ─── Title ────────────────────────────────────────────────────────────────────\n\n/** Popover.Title props — div 속성. */\ntype PopoverTitleProps = ComponentPropsWithoutRef<\"div\"> & {\n ref?: Ref<HTMLDivElement>;\n};\n\n/** 카드 상단 한 줄 제목(넘치면 말줄임). 시각적 제목이며 aria 연결은 하지 않는다. */\nfunction PopoverTitle({ className, ref, ...props }: PopoverTitleProps) {\n return (\n <div\n ref={ref}\n className={cn(\n \"aivex:w-full aivex:px-xs aivex:text-body-md-medium aivex:text-text-primary aivex:truncate\",\n className,\n )}\n {...props}\n />\n );\n}\n\n// ─── Body (ItemArea) ────────────────────────────────────────────────────────────\n\n/** Popover.Body props — div 속성. */\ntype PopoverBodyProps = ComponentPropsWithoutRef<\"div\"> & {\n ref?: Ref<HTMLDivElement>;\n};\n\n/** 검색창·목록 등 자유롭게 들어가는 스크롤 영역입니다. */\nfunction PopoverBody({ className, ref, ...props }: PopoverBodyProps) {\n return (\n <div\n ref={ref}\n className={cn(\n \"aivex:flex aivex:min-h-0 aivex:w-full aivex:flex-1 aivex:flex-col aivex:gap-md aivex:overflow-y-auto\",\n className,\n )}\n {...props}\n />\n );\n}\n\n// ─── Footer (BtnContainer) ──────────────────────────────────────────────────────\n\n/** Popover.Footer props — div 속성 + 좌측 슬롯. */\ninterface PopoverFooterProps extends ComponentPropsWithoutRef<\"div\"> {\n /** 좌측에 넓게 붙는 영역(예: 옵션 tertiary 버튼). 지정 시 나머지 버튼은 우측 정렬됩니다. */\n start?: ReactNode;\n ref?: Ref<HTMLDivElement>;\n}\n\n/** 하단 버튼 줄 — children은 우측 정렬, start는 좌측에 붙는다. */\nfunction PopoverFooter({ className, start, children, ref, ...props }: PopoverFooterProps) {\n return (\n <div\n ref={ref}\n className={cn(\n \"aivex:flex aivex:w-full aivex:items-center aivex:justify-end aivex:gap-md\",\n className,\n )}\n {...props}\n >\n {start && (\n <div className=\"aivex:flex aivex:min-w-0 aivex:flex-1 aivex:flex-col aivex:items-start aivex:justify-center\">\n {start}\n </div>\n )}\n {children}\n </div>\n );\n}\n\n// ─── Compound export ──────────────────────────────────────────────────────────\n\n/**\n * 트리거 옆에 뜨는 비모달 카드(필터·옵션 선택 등)를 만드는 컴파운드 컴포넌트.\n *\n * 버튼을 눌러 검색·체크 목록·적용 버튼 같은 상호작용 내용을 띄울 때 쓴다. 호버로 짧은 설명만\n * 보이면 Tooltip, 화면을 막고 작업을 받아야 하면 Modal을 쓴다. open/onOpenChange로 제어하거나\n * 비제어로 쓰며, 바깥 클릭·Esc로 닫힌다. 버튼으로 닫으려면 Popover.Close의 render로 그 버튼을 넘긴다.\n *\n * @example\n * ```tsx\n * import { Button, Popover, ToggleButton } from \"@aivex/ui\";\n *\n * <Popover>\n * <Popover.Trigger render={<ToggleButton>필터</ToggleButton>} />\n * <Popover.Content>\n * <Popover.Title>상태 필터</Popover.Title>\n * <Popover.Body>…</Popover.Body>\n * <Popover.Footer start={<Button variant=\"ghost\">초기화</Button>}>\n * <Popover.Close render={<Button variant=\"solid\" color=\"secondary\">취소</Button>} />\n * <Button onClick={apply}>적용하기</Button>\n * </Popover.Footer>\n * </Popover.Content>\n * </Popover>\n * ```\n */\nconst Popover = Object.assign(PopoverRoot, {\n Trigger: PopoverTrigger,\n Close: PopoverClose,\n Content: PopoverContent,\n Title: PopoverTitle,\n Body: PopoverBody,\n Footer: PopoverFooter,\n});\n\nexport type {\n PopoverBodyProps,\n PopoverCloseProps,\n PopoverContentProps,\n PopoverFooterProps,\n PopoverRootProps,\n PopoverTitleProps,\n PopoverTriggerProps,\n};\nexport { Popover, popoverContentBaseClassName, popoverPositionerClassName };\n"],"mappings":";;;;;;;;AAcA,IAAM,IAA8B,EAClC,yEACA,oCACA,sBACA,gEACA,8DACA,+DACD,EAGK,IAA6B,mDAG7B,IAAmB,EACvB,GACA,mBAEA,0GACD;AAOD,SAAS,EAAY,GAAyB;AAC5C,QAAO,kBAAC,EAAiB,MAAlB,EAAuB,GAAI,GAAS,CAAA;;AAW7C,SAAS,EAAe,EAAE,QAAK,GAAG,KAA8B;AAC9D,QAAO,kBAAC,EAAiB,SAAlB;EAA+B;EAAK,GAAI;EAAS,CAAA;;AAW1D,SAAS,EAAa,EAAE,QAAK,GAAG,KAA4B;AAC1D,QAAO,kBAAC,EAAiB,OAAlB;EAA6B;EAAK,GAAI;EAAS,CAAA;;
|
|
1
|
+
{"version":3,"file":"Popover.js","names":[],"sources":["../../../src/components/Popover/Popover.tsx"],"sourcesContent":["\"use client\";\n\nimport { Popover as PopoverPrimitive } from \"@base-ui/react/popover\";\nimport type { ComponentPropsWithoutRef, ReactNode, Ref } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport { PortalEventBoundary } from \"@/utils/PortalEventBoundary\";\nimport { type PopupPositioningProps, splitPositioningProps } from \"@/utils/popupPositioning\";\n\n// ─── Content shell ─────────────────────────────────────────────────────────────\n\n/**\n * Popover 계열 카드의 공통 골격 — 세로 레이아웃·최대 높이·패딩·열림/닫힘\n * 애니메이션. Popover와 Coachmark가 함께 쓰고 폭·표면(배경·테두리)만 각자 정한다.\n */\nconst popoverContentBaseClassName = cn(\n \"aivex:flex aivex:flex-col aivex:gap-lg aivex:max-h-[448px] aivex:p-xl\",\n \"aivex:rounded-xl aivex:shadow-md\",\n \"aivex:outline-none\",\n \"aivex:data-[open]:animate-in aivex:data-[closed]:animate-out\",\n \"aivex:data-[closed]:fade-out-0 aivex:data-[open]:fade-in-0\",\n \"aivex:data-[closed]:zoom-out-95 aivex:data-[open]:zoom-in-95\",\n);\n\n/** 위치를 잡는 바깥 요소(Positioner)의 클래스 — 쌓임 순서는 여기서 정한다. */\nconst popoverPositionerClassName = \"aivex:z-(--aivex-z-dropdown) aivex:outline-none\";\n\n// 폭 277px은 Figma Popover-Dropdown 사양이다(Coachmark의 Popover-Bubble은 280px).\nconst contentClassName = cn(\n popoverContentBaseClassName,\n \"aivex:w-[277px]\",\n // 포털로 body에 붙으므로 글자색을 호스트 body에서 상속받지 않게 배경과 짝으로 지정한다.\n \"aivex:bg-bg-primary aivex:text-text-primary aivex:border aivex:border-border-subtle aivex:overflow-clip\",\n);\n\n// ─── Root ─────────────────────────────────────────────────────────────────────\n\n/** Popover 루트 props — open·defaultOpen·onOpenChange(open, details)·modal. */\ntype PopoverRootProps = PopoverPrimitive.Root.Props;\n\nfunction PopoverRoot(props: PopoverRootProps) {\n return <PopoverPrimitive.Root {...props} />;\n}\n\n// ─── Trigger ──────────────────────────────────────────────────────────────────\n\n/** Popover.Trigger props — button 속성 + `render`. */\ntype PopoverTriggerProps = PopoverPrimitive.Trigger.Props & {\n ref?: Ref<HTMLButtonElement>;\n};\n\n/** `render`로 ToggleButton 등 임의의 버튼을 트리거로 쓴다. 버튼이 아닌 요소면 `nativeButton={false}`를 준다. */\nfunction PopoverTrigger({ ref, ...props }: PopoverTriggerProps) {\n return <PopoverPrimitive.Trigger ref={ref} {...props} />;\n}\n\n// ─── Close ────────────────────────────────────────────────────────────────────\n\n/** Popover.Close props — button 속성 + `render`. */\ntype PopoverCloseProps = PopoverPrimitive.Close.Props & {\n ref?: Ref<HTMLButtonElement>;\n};\n\n/** `render`로 하단 버튼을 넘기면 그 버튼을 눌렀을 때 팝오버가 닫힌다. */\nfunction PopoverClose({ ref, ...props }: PopoverCloseProps) {\n return <PopoverPrimitive.Close ref={ref} {...props} />;\n}\n\n// ─── Content ──────────────────────────────────────────────────────────────────\n\n/**\n * Popover.Content props — 카드(div) 속성, 위치 props(side·align·sideOffset·anchor 등),\n * 포커스 이동(initialFocus·finalFocus), 포털 대상.\n */\ntype PopoverContentProps = Omit<PopoverPrimitive.Popup.Props, \"className\"> &\n PopupPositioningProps & {\n className?: string;\n /** 포털 대상. 생략하면 document.body — Shadow DOM 안에서는 그 루트 안의 요소를 넘긴다. */\n container?: PopoverPrimitive.Portal.Props[\"container\"];\n /**\n * 닫혀 있을 때도 DOM에 남겨 둔다.\n * @default false\n */\n keepMounted?: boolean;\n ref?: Ref<HTMLDivElement>;\n };\n\n/**\n * 포털로 띄우는 277px 폭 카드. 기본 sideOffset 8, align \"start\".\n * 안에 Popover.Title·Body·Footer를 순서대로 둔다.\n * 트리거가 아닌 요소를 기준으로 띄우려면 `anchor`에 그 요소나 ref를 넘긴다.\n *\n * `anchor`는 위치만 정한다. Esc·포커스 이동은 Trigger와 팝오버 자신에만 걸리므로, 입력을 누르면\n * 그 아래에 뜨는 팝오버(달력 등)는 그 입력을 `Popover.Trigger`의 `render`로 넘긴다\n * (`nativeButton={false}`). 트리거 없이 포커스를 입력에 둔 채 `anchor`만으로 띄우면, 모달 안에서\n * Esc가 팝오버를 건너뛰어 모달을 닫는다. 입력하면서 제안 목록을 고르는 형태는 Autocomplete를 쓴다.\n */\nfunction PopoverContent({ className, container, keepMounted, ref, ...props }: PopoverContentProps) {\n const [{ sideOffset = 8, align = \"start\", ...positioning }, popupProps] =\n splitPositioningProps(props);\n\n return (\n <PortalEventBoundary>\n <PopoverPrimitive.Portal container={container} keepMounted={keepMounted}>\n <PopoverPrimitive.Positioner\n sideOffset={sideOffset}\n align={align}\n className={popoverPositionerClassName}\n {...positioning}\n >\n <PopoverPrimitive.Popup\n ref={ref}\n className={cn(contentClassName, className)}\n {...popupProps}\n />\n </PopoverPrimitive.Positioner>\n </PopoverPrimitive.Portal>\n </PortalEventBoundary>\n );\n}\n\n// ─── Title ────────────────────────────────────────────────────────────────────\n\n/** Popover.Title props — div 속성. */\ntype PopoverTitleProps = ComponentPropsWithoutRef<\"div\"> & {\n ref?: Ref<HTMLDivElement>;\n};\n\n/** 카드 상단 한 줄 제목(넘치면 말줄임). 시각적 제목이며 aria 연결은 하지 않는다. */\nfunction PopoverTitle({ className, ref, ...props }: PopoverTitleProps) {\n return (\n <div\n ref={ref}\n className={cn(\n \"aivex:w-full aivex:px-xs aivex:text-body-md-medium aivex:text-text-primary aivex:truncate\",\n className,\n )}\n {...props}\n />\n );\n}\n\n// ─── Body (ItemArea) ────────────────────────────────────────────────────────────\n\n/** Popover.Body props — div 속성. */\ntype PopoverBodyProps = ComponentPropsWithoutRef<\"div\"> & {\n ref?: Ref<HTMLDivElement>;\n};\n\n/** 검색창·목록 등 자유롭게 들어가는 스크롤 영역입니다. */\nfunction PopoverBody({ className, ref, ...props }: PopoverBodyProps) {\n return (\n <div\n ref={ref}\n className={cn(\n \"aivex:flex aivex:min-h-0 aivex:w-full aivex:flex-1 aivex:flex-col aivex:gap-md aivex:overflow-y-auto\",\n className,\n )}\n {...props}\n />\n );\n}\n\n// ─── Footer (BtnContainer) ──────────────────────────────────────────────────────\n\n/** Popover.Footer props — div 속성 + 좌측 슬롯. */\ninterface PopoverFooterProps extends ComponentPropsWithoutRef<\"div\"> {\n /** 좌측에 넓게 붙는 영역(예: 옵션 tertiary 버튼). 지정 시 나머지 버튼은 우측 정렬됩니다. */\n start?: ReactNode;\n ref?: Ref<HTMLDivElement>;\n}\n\n/** 하단 버튼 줄 — children은 우측 정렬, start는 좌측에 붙는다. */\nfunction PopoverFooter({ className, start, children, ref, ...props }: PopoverFooterProps) {\n return (\n <div\n ref={ref}\n className={cn(\n \"aivex:flex aivex:w-full aivex:items-center aivex:justify-end aivex:gap-md\",\n className,\n )}\n {...props}\n >\n {start && (\n <div className=\"aivex:flex aivex:min-w-0 aivex:flex-1 aivex:flex-col aivex:items-start aivex:justify-center\">\n {start}\n </div>\n )}\n {children}\n </div>\n );\n}\n\n// ─── Compound export ──────────────────────────────────────────────────────────\n\n/**\n * 트리거 옆에 뜨는 비모달 카드(필터·옵션 선택 등)를 만드는 컴파운드 컴포넌트.\n *\n * 버튼을 눌러 검색·체크 목록·적용 버튼 같은 상호작용 내용을 띄울 때 쓴다. 호버로 짧은 설명만\n * 보이면 Tooltip, 화면을 막고 작업을 받아야 하면 Modal을 쓴다. open/onOpenChange로 제어하거나\n * 비제어로 쓰며, 바깥 클릭·Esc로 닫힌다. 버튼으로 닫으려면 Popover.Close의 render로 그 버튼을 넘긴다.\n *\n * @example\n * ```tsx\n * import { Button, Popover, ToggleButton } from \"@aivex/ui\";\n *\n * <Popover>\n * <Popover.Trigger render={<ToggleButton>필터</ToggleButton>} />\n * <Popover.Content>\n * <Popover.Title>상태 필터</Popover.Title>\n * <Popover.Body>…</Popover.Body>\n * <Popover.Footer start={<Button variant=\"ghost\">초기화</Button>}>\n * <Popover.Close render={<Button variant=\"solid\" color=\"secondary\">취소</Button>} />\n * <Button onClick={apply}>적용하기</Button>\n * </Popover.Footer>\n * </Popover.Content>\n * </Popover>\n * ```\n */\nconst Popover = Object.assign(PopoverRoot, {\n Trigger: PopoverTrigger,\n Close: PopoverClose,\n Content: PopoverContent,\n Title: PopoverTitle,\n Body: PopoverBody,\n Footer: PopoverFooter,\n});\n\nexport type {\n PopoverBodyProps,\n PopoverCloseProps,\n PopoverContentProps,\n PopoverFooterProps,\n PopoverRootProps,\n PopoverTitleProps,\n PopoverTriggerProps,\n};\nexport { Popover, popoverContentBaseClassName, popoverPositionerClassName };\n"],"mappings":";;;;;;;;AAcA,IAAM,IAA8B,EAClC,yEACA,oCACA,sBACA,gEACA,8DACA,+DACD,EAGK,IAA6B,mDAG7B,IAAmB,EACvB,GACA,mBAEA,0GACD;AAOD,SAAS,EAAY,GAAyB;AAC5C,QAAO,kBAAC,EAAiB,MAAlB,EAAuB,GAAI,GAAS,CAAA;;AAW7C,SAAS,EAAe,EAAE,QAAK,GAAG,KAA8B;AAC9D,QAAO,kBAAC,EAAiB,SAAlB;EAA+B;EAAK,GAAI;EAAS,CAAA;;AAW1D,SAAS,EAAa,EAAE,QAAK,GAAG,KAA4B;AAC1D,QAAO,kBAAC,EAAiB,OAAlB;EAA6B;EAAK,GAAI;EAAS,CAAA;;AAgCxD,SAAS,EAAe,EAAE,cAAW,cAAW,gBAAa,QAAK,GAAG,KAA8B;CACjG,IAAM,CAAC,EAAE,gBAAa,GAAG,WAAQ,SAAS,GAAG,KAAe,KAC1D,EAAsB,EAAM;AAE9B,QACE,kBAAC,GAAD,EAAA,UACE,kBAAC,EAAiB,QAAlB;EAAoC;EAAwB;YAC1D,kBAAC,EAAiB,YAAlB;GACc;GACL;GACP,WAAW;GACX,GAAI;aAEJ,kBAAC,EAAiB,OAAlB;IACO;IACL,WAAW,EAAG,GAAkB,EAAU;IAC1C,GAAI;IACJ,CAAA;GAC0B,CAAA;EACN,CAAA,EACN,CAAA;;AAY1B,SAAS,EAAa,EAAE,cAAW,QAAK,GAAG,KAA4B;AACrE,QACE,kBAAC,OAAD;EACO;EACL,WAAW,EACT,6FACA,EACD;EACD,GAAI;EACJ,CAAA;;AAYN,SAAS,EAAY,EAAE,cAAW,QAAK,GAAG,KAA2B;AACnE,QACE,kBAAC,OAAD;EACO;EACL,WAAW,EACT,wGACA,EACD;EACD,GAAI;EACJ,CAAA;;AAcN,SAAS,EAAc,EAAE,cAAW,UAAO,aAAU,QAAK,GAAG,KAA6B;AACxF,QACE,kBAAC,OAAD;EACO;EACL,WAAW,EACT,6EACA,EACD;EACD,GAAI;YANN,CAQG,KACC,kBAAC,OAAD;GAAK,WAAU;aACZ;GACG,CAAA,EAEP,EACG;;;AA8BV,IAAM,IAAU,OAAO,OAAO,GAAa;CACzC,SAAS;CACT,OAAO;CACP,SAAS;CACT,OAAO;CACP,MAAM;CACN,QAAQ;CACT,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils.cjs`),t=require(`../../utils/useControllableState.cjs`),n=require(
|
|
1
|
+
"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils.cjs`),t=require(`../../utils/useControllableState.cjs`),n=require(`../InputBase/useInputState.cjs`),r=require(`../../utils/PortalEventBoundary.cjs`),i=require(`../ScrollArea/ScrollArea.cjs`),a=require(`../SelectButton/SelectButton.cjs`);let o=require(`react`),s=require(`react/jsx-runtime`),c=require(`@base-ui/react/select`);function l({groups:l,value:u,defaultValue:d,placeholder:f=``,disabled:p=!1,size:m=`md`,onValueChange:h,renderValue:g,className:_,error:v,id:y,"aria-describedby":b,"aria-invalid":x,"aria-label":S,"aria-labelledby":C,name:w,required:T,ref:E}){let[D,O]=(0,o.useState)(!1),[k,A]=t.useControllableState({value:u,defaultValue:d??``,onChange:h}),j=n.resolveInputError(v,x),M=(()=>{for(let e of l){let t=e.options.find(e=>e.value===k);if(t)return g?g(t,e):t.label}})(),N={...S!=null&&{"aria-label":S},...C!=null&&{"aria-labelledby":C},...b!=null&&{"aria-describedby":b},...j&&{"aria-invalid":!0}};return(0,s.jsxs)(c.Select.Root,{value:k===``?null:k,name:w,required:T,onValueChange:e=>A(e??``),disabled:p,open:D,onOpenChange:O,children:[(0,s.jsx)(c.Select.Trigger,{ref:E,id:y,disabled:p,...N,render:(0,s.jsx)(a.SelectButton,{value:M,placeholder:f,size:m,error:j,open:D,className:_})}),(0,s.jsx)(r.PortalEventBoundary,{children:(0,s.jsx)(c.Select.Portal,{children:(0,s.jsx)(c.Select.Positioner,{alignItemWithTrigger:!1,side:`bottom`,align:`start`,sideOffset:4,className:`aivex:z-50 aivex:outline-none`,children:(0,s.jsx)(c.Select.Popup,{className:e.cn(`aivex:min-w-(--anchor-width) aivex:max-w-(--anchor-width)`,`aivex:rounded-md aivex:bg-bg-primary aivex:shadow-md aivex:border aivex:border-border-subtle`,`aivex:overflow-hidden aivex:outline-none`,`aivex:data-[open]:animate-in aivex:data-[open]:fade-in-0 aivex:data-[open]:zoom-in-95`,`aivex:data-[closed]:animate-out aivex:data-[closed]:fade-out-0 aivex:data-[closed]:zoom-out-95`),children:(0,s.jsx)(i.ScrollArea,{type:`auto`,className:`aivex:w-full`,viewportClassName:`aivex:max-h-[312px] aivex:p-xs`,children:l.map((t,n)=>(0,s.jsxs)(o.Fragment,{children:[n>0&&(0,s.jsx)(c.Select.Separator,{className:`aivex:my-xs aivex:border-t aivex:border-border-default`}),(0,s.jsxs)(c.Select.Group,{children:[t.title&&(0,s.jsx)(c.Select.GroupLabel,{className:`aivex:px-lg aivex:py-xs aivex:text-caption-md aivex:text-text-tertiary aivex:select-none`,children:t.title}),t.options.map(t=>(0,s.jsxs)(c.Select.Item,{value:t.value,label:t.label,disabled:t.disabled,className:e.cn(`aivex:relative aivex:overflow-hidden aivex:group`,`aivex:flex aivex:h-8 aivex:w-full aivex:items-center`,`aivex:px-lg aivex:rounded-sm aivex:transition-colors`,`aivex:cursor-pointer aivex:select-none aivex:outline-none`,`aivex:data-[disabled]:cursor-not-allowed aivex:data-[disabled]:opacity-disable`,m===`sm`?`aivex:text-body-md-regular`:`aivex:text-body-lg-regular`,t.danger?`aivex:text-text-danger`:`aivex:text-text-primary`),children:[(0,s.jsx)(`span`,{className:e.cn(`aivex:pointer-events-none aivex:absolute aivex:inset-0 aivex:opacity-0 aivex:transition-opacity`,t.danger?`aivex:bg-bg-danger aivex:group-data-[highlighted]:opacity-8 aivex:group-active:opacity-16`:`aivex:bg-bg-inverse-strong aivex:group-data-[highlighted]:opacity-4 aivex:group-active:opacity-8`)}),(0,s.jsx)(c.Select.ItemText,{render:(0,s.jsx)(`span`,{}),children:(0,s.jsx)(`span`,{className:`aivex:truncate`,children:t.label})})]},t.key??t.value))]})]},t.title??`group-${n}`))})})})})})]})}exports.SelectBox=l;
|
|
2
2
|
//# sourceMappingURL=SelectBox.cjs.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../../utils.js";
|
|
3
3
|
import { useControllableState as t } from "../../utils/useControllableState.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { resolveInputError as n } from "../InputBase/useInputState.js";
|
|
5
|
+
import { PortalEventBoundary as r } from "../../utils/PortalEventBoundary.js";
|
|
6
6
|
import { ScrollArea as i } from "../ScrollArea/ScrollArea.js";
|
|
7
7
|
import { SelectButton as a } from "../SelectButton/SelectButton.js";
|
|
8
8
|
import { Fragment as o, useState as s } from "react";
|
|
@@ -14,7 +14,7 @@ function d({ groups: d, value: f, defaultValue: p, placeholder: m = "", disabled
|
|
|
14
14
|
value: f,
|
|
15
15
|
defaultValue: p ?? "",
|
|
16
16
|
onChange: _
|
|
17
|
-
}), N =
|
|
17
|
+
}), N = n(b, C), P = (() => {
|
|
18
18
|
for (let e of d) {
|
|
19
19
|
let t = e.options.find((e) => e.value === j);
|
|
20
20
|
if (t) return v ? v(t, e) : t.label;
|
|
@@ -46,7 +46,7 @@ function d({ groups: d, value: f, defaultValue: p, placeholder: m = "", disabled
|
|
|
46
46
|
open: k,
|
|
47
47
|
className: y
|
|
48
48
|
})
|
|
49
|
-
}), /* @__PURE__ */ c(
|
|
49
|
+
}), /* @__PURE__ */ c(r, { children: /* @__PURE__ */ c(u.Portal, { children: /* @__PURE__ */ c(u.Positioner, {
|
|
50
50
|
alignItemWithTrigger: !1,
|
|
51
51
|
side: "bottom",
|
|
52
52
|
align: "start",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../Icon/index.cjs`),t=require(`../../utils.cjs`),n=require(`../InputBase/
|
|
1
|
+
"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../Icon/index.cjs`),t=require(`../../utils.cjs`),n=require(`../InputBase/InputBase.cjs`),r=require(`../InputBase/useInputState.cjs`);let i=require(`react/jsx-runtime`);function a({value:a,placeholder:o=``,size:s=`md`,error:c=!1,open:l=!1,disabled:u,className:d,ref:f,onFocus:p,onBlur:m,type:h=`button`,"aria-expanded":g,children:_,...v}){let y=r.useInputFocus({onFocus:p,onBlur:m}),b=r.resolveInputError(c,v[`aria-invalid`]),x=s===`sm`?16:20;return(0,i.jsx)(`button`,{ref:f,type:h,disabled:u,"aria-expanded":g??l,onFocus:y.onFocus,onBlur:y.onBlur,className:t.cn(`aivex:w-full aivex:cursor-pointer aivex:rounded-md aivex:text-left aivex:outline-none`,u&&`aivex:cursor-not-allowed`,d),...v,children:(0,i.jsxs)(n.InputBase,{disabled:u,focused:l||y.focused,error:b,filled:a!=null&&a!==``,size:s,layout:`inline`,endContent:(0,i.jsx)(`span`,{className:t.cn(`aivex:transition-transform aivex:duration-200 aivex:text-text-secondary`,l&&`aivex:rotate-180`),children:(0,i.jsx)(e.DirectionDownIcon,{size:x})}),children:[(0,i.jsx)(`span`,{className:t.cn(`aivex:flex-1 aivex:min-w-0 aivex:truncate`,s===`sm`?`aivex:text-body-md-regular`:`aivex:text-body-lg-regular`,a!=null&&a!==``?`aivex:text-text-primary`:`aivex:text-text-tertiary`),children:a??o}),_]})})}exports.SelectButton=a;
|
|
2
2
|
//# sourceMappingURL=SelectButton.cjs.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { DirectionDownIcon as e } from "../Icon/index.js";
|
|
3
3
|
import { cn as t } from "../../utils.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { InputBase as n } from "../InputBase/InputBase.js";
|
|
5
|
+
import { resolveInputError as r, useInputFocus as i } from "../InputBase/useInputState.js";
|
|
6
6
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
7
|
//#region src/components/SelectButton/SelectButton.tsx
|
|
8
8
|
function s({ value: s, placeholder: c = "", size: l = "md", error: u = !1, open: d = !1, disabled: f, className: p, ref: m, onFocus: h, onBlur: g, type: _ = "button", "aria-expanded": v, children: y, ...b }) {
|
|
9
|
-
let x =
|
|
9
|
+
let x = i({
|
|
10
10
|
onFocus: h,
|
|
11
11
|
onBlur: g
|
|
12
|
-
}), S =
|
|
12
|
+
}), S = r(u, b["aria-invalid"]), C = l === "sm" ? 16 : 20;
|
|
13
13
|
return /* @__PURE__ */ a("button", {
|
|
14
14
|
ref: m,
|
|
15
15
|
type: _,
|
|
@@ -19,7 +19,7 @@ function s({ value: s, placeholder: c = "", size: l = "md", error: u = !1, open:
|
|
|
19
19
|
onBlur: x.onBlur,
|
|
20
20
|
className: t("aivex:w-full aivex:cursor-pointer aivex:rounded-md aivex:text-left aivex:outline-none", f && "aivex:cursor-not-allowed", p),
|
|
21
21
|
...b,
|
|
22
|
-
children: /* @__PURE__ */ o(
|
|
22
|
+
children: /* @__PURE__ */ o(n, {
|
|
23
23
|
disabled: f,
|
|
24
24
|
focused: d || x.focused,
|
|
25
25
|
error: S,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils.cjs`),t=require(`../../utils/useControllableState.cjs`),n=require(`../
|
|
1
|
+
"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils.cjs`),t=require(`../../utils/useControllableState.cjs`),n=require(`../Field/FieldStateContext.cjs`),r=require(`../InputBase/InputBase.cjs`),i=require(`../InputBase/useInputState.cjs`),a=require(`../Tag/Tag.cjs`);let o=require(`react`),s=require(`react/jsx-runtime`),c=require(`@base-ui/react/input`);function l({className:l,size:u=`sm`,error:d,disabled:f,readOnly:p,value:m,defaultValue:h=[],onValueChange:g,parsePaste:_,validate:v,renderTag:y,placeholder:b,id:x,ref:S,onBlur:C,onCompositionEnd:w,onCompositionStart:T,onFocus:E,onKeyDown:D,onPaste:O,...k}){let[A,j]=t.useControllableState({value:m,defaultValue:h,onChange:g}),[M,N]=(0,o.useState)(``),P=(0,o.useRef)(!1),F=i.useInputFocus({onFocus:E,onBlur:C}),I=n.useFieldState(),L=!!f||I.disabled,R=F.focused&&!p,z=v?A.some(e=>!v(e)):!1,B=i.resolveInputError(d,k[`aria-invalid`])||I.invalid||z,V=e=>{let t=e.trim();t&&(A.includes(t)||(j([...A,t]),N(``)))},H=e=>{j(A.filter((t,n)=>n!==e))},U=e=>{if(D?.(e),!e.defaultPrevented&&!p)if(e.key===`Enter`){if(P.current||e.nativeEvent.isComposing||e.nativeEvent.keyCode===229)return;e.preventDefault(),M&&V(M)}else e.key===`Backspace`&&!M&&A.length>0&&H(A.length-1)},W=e=>{if(O?.(e),e.defaultPrevented||p||!_)return;e.preventDefault();let t=_(e.clipboardData.getData(`text`)),n=[...new Set(t.map(e=>e.trim()))].filter(e=>e&&!A.includes(e));n.length>0&&j([...A,...n]),N(``)},G=A.map((e,t)=>{let n=()=>H(t),r=v?v(e)?`default`:`error`:B?`error`:`default`;return y?(0,s.jsx)(o.Fragment,{children:y(e,t,{remove:n,size:u,disabled:L,readOnly:p,variant:r})},`${e}-${t}`):(0,s.jsx)(a.Tag,{size:u===`md`?`md`:`sm`,variant:r,disabled:L,onRemove:p?void 0:n,removeAriaLabel:`${e} 삭제`,children:e},`${e}-${t}`)}),K=(0,s.jsx)(c.Input,{ref:S,id:x,value:M,disabled:f,readOnly:p,placeholder:A.length===0?b:void 0,onChange:e=>{p||N(e.target.value)},onKeyDown:U,onPaste:W,onCompositionStart:e=>{P.current=!0,T?.(e)},onCompositionEnd:e=>{P.current=!1,p||N(e.currentTarget.value),w?.(e)},onFocus:F.onFocus,onBlur:e=>{F.onBlur(e),!p&&!P.current&&M&&V(M)},className:e.cn(`aivex:bg-transparent aivex:outline-none aivex:text-text-primary aivex:placeholder:text-text-tertiary aivex:min-w-[80px] aivex:flex-1`,p&&`aivex:cursor-default`,u===`sm`?`aivex:text-body-md-regular aivex:h-6`:`aivex:text-body-lg-regular aivex:h-8`),...k});return(0,s.jsxs)(r.InputBase,{error:B,disabled:L,focused:R,size:u,layout:`wrap`,className:e.cn(l,p&&`aivex:cursor-default`),children:[G,K]})}exports.Tagbox=l;
|
|
2
2
|
//# sourceMappingURL=Tagbox.cjs.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn as e } from "../../utils.js";
|
|
3
3
|
import { useControllableState as t } from "../../utils/useControllableState.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { useFieldState as n } from "../Field/FieldStateContext.js";
|
|
5
|
+
import { InputBase as r } from "../InputBase/InputBase.js";
|
|
6
|
+
import { resolveInputError as i, useInputFocus as a } from "../InputBase/useInputState.js";
|
|
7
|
+
import { Tag as o } from "../Tag/Tag.js";
|
|
8
8
|
import { Fragment as s, useRef as c, useState as l } from "react";
|
|
9
9
|
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
10
10
|
import { Input as f } from "@base-ui/react/input";
|
|
@@ -14,10 +14,10 @@ function p({ className: p, size: m = "sm", error: h, disabled: g, readOnly: _, v
|
|
|
14
14
|
value: v,
|
|
15
15
|
defaultValue: y,
|
|
16
16
|
onChange: b
|
|
17
|
-
}), [I, L] = l(""), R = c(!1), z =
|
|
17
|
+
}), [I, L] = l(""), R = c(!1), z = a({
|
|
18
18
|
onFocus: A,
|
|
19
19
|
onBlur: D
|
|
20
|
-
}), B =
|
|
20
|
+
}), B = n(), V = !!g || B.disabled, H = z.focused && !_, U = S ? P.some((e) => !S(e)) : !1, W = i(h, N["aria-invalid"]) || B.invalid || U, G = (e) => {
|
|
21
21
|
let t = e.trim();
|
|
22
22
|
t && (P.includes(t) || (F([...P, t]), L("")));
|
|
23
23
|
}, K = (e) => {
|
|
@@ -40,7 +40,7 @@ function p({ className: p, size: m = "sm", error: h, disabled: g, readOnly: _, v
|
|
|
40
40
|
disabled: V,
|
|
41
41
|
readOnly: _,
|
|
42
42
|
variant: r
|
|
43
|
-
}) }, `${e}-${t}`) : /* @__PURE__ */ u(
|
|
43
|
+
}) }, `${e}-${t}`) : /* @__PURE__ */ u(o, {
|
|
44
44
|
size: m === "md" ? "md" : "sm",
|
|
45
45
|
variant: r,
|
|
46
46
|
disabled: V,
|
|
@@ -73,7 +73,7 @@ function p({ className: p, size: m = "sm", error: h, disabled: g, readOnly: _, v
|
|
|
73
73
|
className: e("aivex:bg-transparent aivex:outline-none aivex:text-text-primary aivex:placeholder:text-text-tertiary aivex:min-w-[80px] aivex:flex-1", _ && "aivex:cursor-default", m === "sm" ? "aivex:text-body-md-regular aivex:h-6" : "aivex:text-body-lg-regular aivex:h-8"),
|
|
74
74
|
...N
|
|
75
75
|
});
|
|
76
|
-
return /* @__PURE__ */ d(
|
|
76
|
+
return /* @__PURE__ */ d(r, {
|
|
77
77
|
error: W,
|
|
78
78
|
disabled: V,
|
|
79
79
|
focused: H,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils.cjs`),t=require(`../
|
|
1
|
+
"use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`../../utils.cjs`),t=require(`../Field/FieldStateContext.cjs`),n=require(`../InputBase/InputBase.cjs`),r=require(`../InputBase/useInputState.cjs`);let i=require(`react`),a=require(`react/jsx-runtime`),o=require(`@base-ui/react/input`);function s({className:s,error:c,disabled:l,size:u=`md`,minHeight:d,fixedHeight:f,startContent:p,endContent:m,id:h,ref:g,onFocus:_,onBlur:v,maxCount:y,value:b,defaultValue:x,onChange:S,onValueChange:C,...w}){let T=r.useInputFocus({onFocus:_,onBlur:v}),E=t.useFieldState(),D=y!=null,O=e=>e==null?0:String(e).length,[k,A]=(0,i.useState)(()=>O(b??x)),j=b==null?k:O(b),M=r.resolveInputError(c,w[`aria-invalid`])||E.invalid,N=!!l||E.disabled,P=M||D&&j>y,F=e=>{A(e.target.value.length),C?.(e.target.value),S?.(e)},I={};d!==void 0&&(I.minHeight=typeof d==`number`?`${d}px`:d),f&&d!==void 0&&(I.height=I.minHeight,I.maxHeight=I.minHeight);let L=(0,a.jsx)(o.Input,{ref:g,id:h,disabled:l,value:b,defaultValue:x,className:e.cn(`aivex:w-full aivex:min-w-0 aivex:bg-transparent aivex:text-text-primary aivex:placeholder:text-text-tertiary aivex:outline-none`,u===`sm`?`aivex:text-body-md-regular`:`aivex:text-body-lg-regular`,`aivex:resize-none aivex:overflow-auto`,s),onChange:F,onFocus:T.onFocus,onBlur:T.onBlur,render:(0,a.jsx)(`textarea`,{style:I,...w})});return(0,a.jsx)(n.InputBase,{error:P,disabled:N,focused:T.focused,filled:j>0,size:u,layout:`block`,startContent:p,endContent:m,children:D?(0,a.jsxs)(`div`,{className:`aivex:flex aivex:w-full aivex:flex-col aivex:gap-xs`,children:[L,(0,a.jsxs)(`div`,{className:`aivex:flex aivex:w-full aivex:items-center aivex:justify-end aivex:gap-2xs aivex:text-body-sm-regular aivex:whitespace-nowrap`,children:[(0,a.jsx)(`span`,{className:P?`aivex:text-text-danger`:`aivex:text-text-tertiary`,children:j}),(0,a.jsx)(`span`,{className:`aivex:text-text-tertiary`,children:`/ ${y}`})]})]}):L})}exports.Textarea=s;
|
|
2
2
|
//# sourceMappingURL=Textarea.cjs.map
|