@acronis-platform/ui-react 0.47.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/alert/alert.js +99 -0
- package/dist/components/ui/alert/alert.js.map +1 -0
- package/dist/components/ui/combobox/combobox.js +149 -0
- package/dist/components/ui/combobox/combobox.js.map +1 -0
- package/dist/components/ui/field/field.js +189 -0
- package/dist/components/ui/field/field.js.map +1 -0
- package/dist/components/ui/form/form.js +16 -0
- package/dist/components/ui/form/form.js.map +1 -0
- package/dist/components/ui/skeleton/skeleton.js +22 -0
- package/dist/components/ui/skeleton/skeleton.js.map +1 -0
- package/dist/index.js +292 -258
- package/dist/index.js.map +1 -1
- package/dist/react.js +292 -258
- package/dist/react.js.map +1 -1
- package/dist/src/components/ui/alert/alert.d.ts +14 -0
- package/dist/src/components/ui/alert/index.d.ts +2 -0
- package/dist/src/components/ui/button/button.d.ts +1 -1
- package/dist/src/components/ui/combobox/combobox.d.ts +28 -0
- package/dist/src/components/ui/combobox/index.d.ts +2 -0
- package/dist/src/components/ui/field/field.d.ts +39 -0
- package/dist/src/components/ui/field/field.docs.d.ts +27 -0
- package/dist/src/components/ui/field/index.d.ts +2 -0
- package/dist/src/components/ui/form/form.d.ts +6 -0
- package/dist/src/components/ui/form/index.d.ts +1 -0
- package/dist/src/components/ui/skeleton/index.d.ts +1 -0
- package/dist/src/components/ui/skeleton/skeleton.d.ts +4 -0
- package/dist/src/components/ui/tag/tag.d.ts +1 -1
- package/dist/src/index.d.ts +6 -0
- package/dist/ui-react.css +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import * as e from "react";
|
|
3
|
+
import { cva as i } from "../../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
|
|
4
|
+
import { cn as o } from "../../../lib/utils.js";
|
|
5
|
+
const l = i(
|
|
6
|
+
"relative flex w-full items-start gap-3 rounded-md border p-4 text-foreground",
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
info: "border-[var(--ui-background-status-strong-info)] bg-[var(--ui-background-status-info)] [&_[data-slot=alert-icon]]:text-[var(--ui-background-status-strong-info)]",
|
|
11
|
+
success: "border-[var(--ui-background-status-strong-success)] bg-[var(--ui-background-status-success)] [&_[data-slot=alert-icon]]:text-[var(--ui-background-status-strong-success)]",
|
|
12
|
+
warning: "border-[var(--ui-background-status-strong-warning)] bg-[var(--ui-background-status-warning)] [&_[data-slot=alert-icon]]:text-[var(--ui-background-status-strong-warning)]",
|
|
13
|
+
critical: "border-[var(--ui-background-status-strong-critical)] bg-[var(--ui-background-status-critical)] [&_[data-slot=alert-icon]]:text-[var(--ui-background-status-strong-critical)]",
|
|
14
|
+
destructive: "border-[var(--ui-background-status-strong-danger)] bg-[var(--ui-background-status-danger)] [&_[data-slot=alert-icon]]:text-[var(--ui-background-status-strong-danger)]",
|
|
15
|
+
ai: "border-[var(--ui-text-on-status-ai)] bg-[var(--ui-background-status-ai)] [&_[data-slot=alert-icon]]:text-[var(--ui-text-on-status-ai)]",
|
|
16
|
+
neutral: "border-[var(--ui-background-status-strong-neutral)] bg-[var(--ui-background-status-neutral)] [&_[data-slot=alert-icon]]:text-[var(--ui-background-status-strong-neutral)]"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
defaultVariants: {
|
|
20
|
+
variant: "info"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
), u = e.forwardRef(
|
|
24
|
+
({ className: t, variant: a, ...r }, n) => /* @__PURE__ */ s(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
ref: n,
|
|
28
|
+
role: "alert",
|
|
29
|
+
"data-slot": "alert",
|
|
30
|
+
className: o(l({ variant: a }), t),
|
|
31
|
+
...r
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
);
|
|
35
|
+
u.displayName = "Alert";
|
|
36
|
+
const c = e.forwardRef(({ className: t, ...a }, r) => (
|
|
37
|
+
// Color is set by the Alert variant (targets [data-slot=alert-icon]). The icon
|
|
38
|
+
// sits in a line-height-matched box (h-6 = leading-6) and is centered in it, so
|
|
39
|
+
// it optically aligns with the first line of the title/description.
|
|
40
|
+
/* @__PURE__ */ s(
|
|
41
|
+
"div",
|
|
42
|
+
{
|
|
43
|
+
ref: r,
|
|
44
|
+
"data-slot": "alert-icon",
|
|
45
|
+
className: o("flex h-6 shrink-0 items-center", t),
|
|
46
|
+
...a
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
));
|
|
50
|
+
c.displayName = "AlertIcon";
|
|
51
|
+
const d = e.forwardRef(({ className: t, ...a }, r) => /* @__PURE__ */ s(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
ref: r,
|
|
55
|
+
"data-slot": "alert-content",
|
|
56
|
+
className: o("flex min-w-0 flex-1 flex-col gap-0.5", t),
|
|
57
|
+
...a
|
|
58
|
+
}
|
|
59
|
+
));
|
|
60
|
+
d.displayName = "AlertContent";
|
|
61
|
+
const g = e.forwardRef(({ className: t, ...a }, r) => /* @__PURE__ */ s(
|
|
62
|
+
"h5",
|
|
63
|
+
{
|
|
64
|
+
ref: r,
|
|
65
|
+
"data-slot": "alert-title",
|
|
66
|
+
className: o("mb-0 text-sm font-semibold leading-6", t),
|
|
67
|
+
...a
|
|
68
|
+
}
|
|
69
|
+
));
|
|
70
|
+
g.displayName = "AlertTitle";
|
|
71
|
+
const b = e.forwardRef(({ className: t, ...a }, r) => /* @__PURE__ */ s(
|
|
72
|
+
"div",
|
|
73
|
+
{
|
|
74
|
+
ref: r,
|
|
75
|
+
"data-slot": "alert-description",
|
|
76
|
+
className: o("text-sm font-normal leading-6", t),
|
|
77
|
+
...a
|
|
78
|
+
}
|
|
79
|
+
));
|
|
80
|
+
b.displayName = "AlertDescription";
|
|
81
|
+
const f = e.forwardRef(({ className: t, ...a }, r) => /* @__PURE__ */ s(
|
|
82
|
+
"div",
|
|
83
|
+
{
|
|
84
|
+
ref: r,
|
|
85
|
+
"data-slot": "alert-actions",
|
|
86
|
+
className: o("flex items-center gap-2", t),
|
|
87
|
+
...a
|
|
88
|
+
}
|
|
89
|
+
));
|
|
90
|
+
f.displayName = "AlertActions";
|
|
91
|
+
export {
|
|
92
|
+
u as Alert,
|
|
93
|
+
f as AlertActions,
|
|
94
|
+
d as AlertContent,
|
|
95
|
+
b as AlertDescription,
|
|
96
|
+
c as AlertIcon,
|
|
97
|
+
g as AlertTitle
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.js","sources":["../../../../src/components/ui/alert/alert.tsx"],"sourcesContent":["import * as React from 'react';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '@/lib/utils';\n\n// Ported from `@acronis-platform/shadcn-uikit`'s `alert`\n// (packages/ui-legacy/src/components/ui/alert.tsx) and reconciled with the Figma\n// design (node 5337-71774): a rounded banner with a *full* border in the strong\n// status color, a pale status surface, foreground text, and only the icon tinted\n// with the status color. No Base UI primitive — semantic markup with\n// `role=\"alert\"`. Each variant maps to the `--ui-*` status tokens: the pale\n// surface (`--ui-background-status-*`) + the saturated border/icon\n// (`--ui-background-status-strong-*`). `destructive` uses the danger tokens; `ai`\n// has no `strong` surface token, so it uses its solid text token for the\n// border + icon.\nconst alertVariants = cva(\n 'relative flex w-full items-start gap-3 rounded-md border p-4 text-foreground',\n {\n variants: {\n variant: {\n info: 'border-[var(--ui-background-status-strong-info)] bg-[var(--ui-background-status-info)] [&_[data-slot=alert-icon]]:text-[var(--ui-background-status-strong-info)]',\n success:\n 'border-[var(--ui-background-status-strong-success)] bg-[var(--ui-background-status-success)] [&_[data-slot=alert-icon]]:text-[var(--ui-background-status-strong-success)]',\n warning:\n 'border-[var(--ui-background-status-strong-warning)] bg-[var(--ui-background-status-warning)] [&_[data-slot=alert-icon]]:text-[var(--ui-background-status-strong-warning)]',\n critical:\n 'border-[var(--ui-background-status-strong-critical)] bg-[var(--ui-background-status-critical)] [&_[data-slot=alert-icon]]:text-[var(--ui-background-status-strong-critical)]',\n destructive:\n 'border-[var(--ui-background-status-strong-danger)] bg-[var(--ui-background-status-danger)] [&_[data-slot=alert-icon]]:text-[var(--ui-background-status-strong-danger)]',\n ai: 'border-[var(--ui-text-on-status-ai)] bg-[var(--ui-background-status-ai)] [&_[data-slot=alert-icon]]:text-[var(--ui-text-on-status-ai)]',\n neutral:\n 'border-[var(--ui-background-status-strong-neutral)] bg-[var(--ui-background-status-neutral)] [&_[data-slot=alert-icon]]:text-[var(--ui-background-status-strong-neutral)]',\n },\n },\n defaultVariants: {\n variant: 'info',\n },\n }\n);\n\nexport interface AlertProps\n extends React.HTMLAttributes<HTMLDivElement>,\n VariantProps<typeof alertVariants> {}\n\nconst Alert = React.forwardRef<HTMLDivElement, AlertProps>(\n ({ className, variant, ...props }, ref) => (\n <div\n ref={ref}\n role=\"alert\"\n data-slot=\"alert\"\n className={cn(alertVariants({ variant }), className)}\n {...props}\n />\n )\n);\nAlert.displayName = 'Alert';\n\nconst AlertIcon = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n // Color is set by the Alert variant (targets [data-slot=alert-icon]). The icon\n // sits in a line-height-matched box (h-6 = leading-6) and is centered in it, so\n // it optically aligns with the first line of the title/description.\n <div\n ref={ref}\n data-slot=\"alert-icon\"\n className={cn('flex h-6 shrink-0 items-center', className)}\n {...props}\n />\n));\nAlertIcon.displayName = 'AlertIcon';\n\nconst AlertContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"alert-content\"\n className={cn('flex min-w-0 flex-1 flex-col gap-0.5', className)}\n {...props}\n />\n));\nAlertContent.displayName = 'AlertContent';\n\nconst AlertTitle = React.forwardRef<\n HTMLHeadingElement,\n React.HTMLAttributes<HTMLHeadingElement>\n>(({ className, ...props }, ref) => (\n <h5\n ref={ref}\n data-slot=\"alert-title\"\n className={cn('mb-0 text-sm font-semibold leading-6', className)}\n {...props}\n />\n));\nAlertTitle.displayName = 'AlertTitle';\n\nconst AlertDescription = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"alert-description\"\n className={cn('text-sm font-normal leading-6', className)}\n {...props}\n />\n));\nAlertDescription.displayName = 'AlertDescription';\n\n// Action slot for alert buttons. Two placements (see the Figma): as a direct\n// child of Alert after AlertContent it sits at the right edge (AlertContent is\n// flex-1) — add `self-center` to center it vertically; placed inside AlertContent\n// (under the description) it flows below the text.\nconst AlertActions = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"alert-actions\"\n className={cn('flex items-center gap-2', className)}\n {...props}\n />\n));\nAlertActions.displayName = 'AlertActions';\n\nexport {\n Alert,\n AlertIcon,\n AlertContent,\n AlertTitle,\n AlertDescription,\n AlertActions,\n};\n"],"names":["alertVariants","cva","Alert","React","className","variant","props","ref","jsx","cn","AlertIcon","AlertContent","AlertTitle","AlertDescription","AlertActions"],"mappings":";;;;AAeA,MAAMA,IAAgBC;AAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,MAAM;AAAA,QACN,SACE;AAAA,QACF,SACE;AAAA,QACF,UACE;AAAA,QACF,aACE;AAAA,QACF,IAAI;AAAA,QACJ,SACE;AAAA,MAAA;AAAA,IACJ;AAAA,IAEF,iBAAiB;AAAA,MACf,SAAS;AAAA,IAAA;AAAA,EACX;AAEJ,GAMMC,IAAQC,EAAM;AAAA,EAClB,CAAC,EAAE,WAAAC,GAAW,SAAAC,GAAS,GAAGC,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A,IACvD,GAAGE;AAAA,EAAA;AACN,CACD;AACDO,EAAiB,cAAc;AAM/B,MAAMC,IAAeX,EAAM,WAGzB,CAAC,EAAE,WAAAC,GAAW,GAAGE,EAAA,GAASC,MAC1B,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,KAAAD;AAAA,IACA,aAAU;AAAA,IACV,WAAWE,EAAG,2BAA2BL,CAAS;AAAA,IACjD,GAAGE;AAAA,EAAA;AACN,CACD;AACDQ,EAAa,cAAc;"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { jsx as e, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import * as n from "react";
|
|
3
|
+
import { Combobox as o } from "@base-ui/react/combobox";
|
|
4
|
+
import { TimesIcon as b, ChevronDownIcon as m, CheckIcon as x } from "@acronis-platform/icons-react/stroke-mono";
|
|
5
|
+
import { cn as a } from "../../../lib/utils.js";
|
|
6
|
+
function v(r) {
|
|
7
|
+
return /* @__PURE__ */ e(o.Root, { ...r });
|
|
8
|
+
}
|
|
9
|
+
v.displayName = "Combobox";
|
|
10
|
+
const g = n.forwardRef(({ className: r, containerClassName: i, clearable: t, ...l }, d) => (
|
|
11
|
+
// InputGroup (not a plain div) is the popup's anchor, so the dropdown aligns to
|
|
12
|
+
// the box's left edge rather than to the bare input inside the box padding.
|
|
13
|
+
/* @__PURE__ */ s(
|
|
14
|
+
o.InputGroup,
|
|
15
|
+
{
|
|
16
|
+
className: a(
|
|
17
|
+
"group flex h-[var(--ui-input-select-global-box-height)] w-full min-w-0 items-center gap-[var(--ui-input-select-global-box-gap)] rounded-[var(--ui-input-select-global-box-border-radius)] border bg-[var(--ui-input-select-global-box-color-idle)] border-[var(--ui-input-select-normal-box-border-color-idle)] px-[var(--ui-input-select-global-box-padding-x)] text-sm leading-6 transition-colors",
|
|
18
|
+
"not-has-disabled:hover:bg-[var(--ui-input-select-global-box-color-hover)] not-has-disabled:hover:border-[var(--ui-input-select-normal-box-border-color-hover)]",
|
|
19
|
+
"has-[input:focus-visible]:border-[var(--ui-input-select-normal-box-border-color-hover)] has-[input:focus-visible]:ring-[3px] has-[input:focus-visible]:ring-[var(--ui-focus-primary)]",
|
|
20
|
+
"has-disabled:cursor-not-allowed has-disabled:border-[var(--ui-input-select-normal-box-border-color-disabled)] has-disabled:bg-[var(--ui-input-select-global-box-color-disabled)]",
|
|
21
|
+
"has-[input[aria-invalid=true]]:border-[var(--ui-input-select-error-box-border-color-idle)] has-[input[aria-invalid=true]:focus-visible]:ring-[var(--ui-focus-error)]",
|
|
22
|
+
i
|
|
23
|
+
),
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ e(
|
|
26
|
+
o.Input,
|
|
27
|
+
{
|
|
28
|
+
ref: d,
|
|
29
|
+
className: a(
|
|
30
|
+
"min-w-0 flex-1 bg-transparent text-[var(--ui-input-select-global-value-color-idle)] outline-none placeholder:text-[var(--ui-input-select-global-placeholder-color-idle)] disabled:cursor-not-allowed disabled:text-[var(--ui-input-select-global-value-color-disabled)]",
|
|
31
|
+
r
|
|
32
|
+
),
|
|
33
|
+
...l
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
t && /* @__PURE__ */ e(
|
|
37
|
+
o.Clear,
|
|
38
|
+
{
|
|
39
|
+
"aria-label": "Clear",
|
|
40
|
+
className: "flex shrink-0 cursor-pointer items-center text-[var(--ui-input-select-normal-icon-expand-color-idle)] outline-none focus-visible:ring-[3px] focus-visible:ring-[var(--ui-focus-primary)] data-[disabled]:hidden",
|
|
41
|
+
children: /* @__PURE__ */ e(b, { size: 16 })
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
/* @__PURE__ */ e(
|
|
45
|
+
o.Trigger,
|
|
46
|
+
{
|
|
47
|
+
"aria-label": "Toggle",
|
|
48
|
+
className: "flex shrink-0 cursor-pointer items-center text-[var(--ui-input-select-normal-icon-expand-color-idle)] outline-none group-has-disabled:text-[var(--ui-input-select-normal-icon-expand-color-disabled)]",
|
|
49
|
+
children: /* @__PURE__ */ e(
|
|
50
|
+
m,
|
|
51
|
+
{
|
|
52
|
+
size: 16,
|
|
53
|
+
className: "transition-transform group-has-[input[aria-expanded=true]]:rotate-180"
|
|
54
|
+
}
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
));
|
|
62
|
+
g.displayName = "ComboboxInput";
|
|
63
|
+
const h = n.forwardRef(
|
|
64
|
+
({ className: r, children: i, sideOffset: t = 4, align: l = "start", side: d = "bottom", portalContainer: c, ...u }, p) => /* @__PURE__ */ e(o.Portal, { container: c, children: /* @__PURE__ */ e(
|
|
65
|
+
o.Positioner,
|
|
66
|
+
{
|
|
67
|
+
sideOffset: t,
|
|
68
|
+
align: l,
|
|
69
|
+
side: d,
|
|
70
|
+
className: "z-50 outline-none",
|
|
71
|
+
children: /* @__PURE__ */ e(
|
|
72
|
+
o.Popup,
|
|
73
|
+
{
|
|
74
|
+
ref: p,
|
|
75
|
+
className: a(
|
|
76
|
+
"max-h-[var(--available-height)] min-w-[var(--anchor-width)] overflow-y-auto rounded-[var(--ui-input-select-dropdown-container-border-radius)] border border-[var(--ui-input-select-dropdown-container-border-color)] bg-[var(--ui-input-select-dropdown-container-color)] py-[var(--ui-input-select-dropdown-container-padding-y)] text-sm shadow-md outline-none",
|
|
77
|
+
r
|
|
78
|
+
),
|
|
79
|
+
...u,
|
|
80
|
+
children: i
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
) })
|
|
85
|
+
);
|
|
86
|
+
h.displayName = "ComboboxContent";
|
|
87
|
+
const f = n.forwardRef(({ className: r, ...i }, t) => /* @__PURE__ */ e(
|
|
88
|
+
o.List,
|
|
89
|
+
{
|
|
90
|
+
ref: t,
|
|
91
|
+
className: a("flex flex-col", r),
|
|
92
|
+
...i
|
|
93
|
+
}
|
|
94
|
+
));
|
|
95
|
+
f.displayName = "ComboboxList";
|
|
96
|
+
const w = n.forwardRef(({ className: r, children: i, ...t }, l) => /* @__PURE__ */ s(
|
|
97
|
+
o.Item,
|
|
98
|
+
{
|
|
99
|
+
ref: l,
|
|
100
|
+
className: a(
|
|
101
|
+
"relative flex cursor-default items-center gap-[var(--ui-input-select-dropdown-item-global-container-gap)] px-[var(--ui-input-select-dropdown-item-global-container-padding-x)] py-[var(--ui-input-select-dropdown-item-global-container-padding-y)] leading-6 text-[var(--ui-input-select-dropdown-item-global-label-color)] outline-none select-none",
|
|
102
|
+
"bg-[var(--ui-input-select-dropdown-item-unselected-container-color-idle)] data-[highlighted]:bg-[var(--ui-input-select-dropdown-item-unselected-container-color-hover)]",
|
|
103
|
+
"data-[selected]:bg-[var(--ui-input-select-dropdown-item-selected-container-color-idle)] data-[selected]:data-[highlighted]:bg-[var(--ui-input-select-dropdown-item-selected-container-color-hover)]",
|
|
104
|
+
"data-[disabled]:pointer-events-none data-[disabled]:bg-[var(--ui-input-select-dropdown-item-unselected-container-color-disabled)]",
|
|
105
|
+
r
|
|
106
|
+
),
|
|
107
|
+
...t,
|
|
108
|
+
children: [
|
|
109
|
+
/* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate", children: i }),
|
|
110
|
+
/* @__PURE__ */ e(o.ItemIndicator, { className: "flex shrink-0 items-center text-[var(--ui-input-select-normal-icon-expand-color-hover)]", children: /* @__PURE__ */ e(x, { size: 16 }) })
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
));
|
|
114
|
+
w.displayName = "ComboboxItem";
|
|
115
|
+
const y = n.forwardRef(({ className: r, ...i }, t) => /* @__PURE__ */ e(
|
|
116
|
+
o.Empty,
|
|
117
|
+
{
|
|
118
|
+
ref: t,
|
|
119
|
+
className: a(
|
|
120
|
+
"px-[var(--ui-input-select-dropdown-item-global-container-padding-x)] py-[var(--ui-input-select-dropdown-item-global-container-padding-y)] text-center text-sm leading-6 text-[var(--ui-input-select-normal-description-color-idle)] empty:m-0 empty:p-0",
|
|
121
|
+
r
|
|
122
|
+
),
|
|
123
|
+
...i
|
|
124
|
+
}
|
|
125
|
+
));
|
|
126
|
+
y.displayName = "ComboboxEmpty";
|
|
127
|
+
const L = o.Group, C = n.forwardRef(({ className: r, ...i }, t) => /* @__PURE__ */ e(
|
|
128
|
+
o.GroupLabel,
|
|
129
|
+
{
|
|
130
|
+
ref: t,
|
|
131
|
+
className: a(
|
|
132
|
+
"px-[var(--ui-input-select-dropdown-section-container-header-padding-x)] py-[var(--ui-input-select-dropdown-section-container-header-padding-y)] text-sm font-semibold leading-6 text-[var(--ui-input-select-dropdown-section-label-group-color)]",
|
|
133
|
+
r
|
|
134
|
+
),
|
|
135
|
+
...i
|
|
136
|
+
}
|
|
137
|
+
));
|
|
138
|
+
C.displayName = "ComboboxGroupLabel";
|
|
139
|
+
export {
|
|
140
|
+
v as Combobox,
|
|
141
|
+
h as ComboboxContent,
|
|
142
|
+
y as ComboboxEmpty,
|
|
143
|
+
L as ComboboxGroup,
|
|
144
|
+
C as ComboboxGroupLabel,
|
|
145
|
+
g as ComboboxInput,
|
|
146
|
+
w as ComboboxItem,
|
|
147
|
+
f as ComboboxList
|
|
148
|
+
};
|
|
149
|
+
//# sourceMappingURL=combobox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox.js","sources":["../../../../src/components/ui/combobox/combobox.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Combobox as ComboboxPrimitive } from '@base-ui/react/combobox';\nimport {\n CheckIcon,\n ChevronDownIcon,\n TimesIcon,\n} from '@acronis-platform/icons-react/stroke-mono';\n\nimport { cn } from '@/lib/utils';\n\n// A searchable single/multi-select built on Base UI's Combobox primitive. The\n// legacy `combobox` was only a hardcoded Popover + cmdk demo; this is a real,\n// reusable component. There is no `--ui-combobox-*` tier, so it reuses the\n// `--ui-input-select-*` tokens (already imported) — the field box, dropdown\n// container, and items match InputSelect, the non-searchable sibling. The Root\n// auto-extracts `{ value, label }` items and filters them by the input value.\n\nfunction Combobox<Value, Multiple extends boolean | undefined = false>(\n props: ComboboxPrimitive.Root.Props<Value, Multiple>\n) {\n return <ComboboxPrimitive.Root {...props} />;\n}\nCombobox.displayName = 'Combobox';\n\nexport interface ComboboxInputProps\n extends Omit<\n React.ComponentPropsWithoutRef<typeof ComboboxPrimitive.Input>,\n 'className'\n > {\n className?: string;\n /** Wrapper (box) className. */\n containerClassName?: string;\n /** Show a clear (✕) button while the field has a value. */\n clearable?: boolean;\n}\n\n// The field box: a typeable input + a clear button (optional) + a chevron trigger.\nconst ComboboxInput = React.forwardRef<\n HTMLInputElement,\n ComboboxInputProps\n>(({ className, containerClassName, clearable, ...props }, ref) => (\n // InputGroup (not a plain div) is the popup's anchor, so the dropdown aligns to\n // the box's left edge rather than to the bare input inside the box padding.\n <ComboboxPrimitive.InputGroup\n className={cn(\n 'group flex h-[var(--ui-input-select-global-box-height)] w-full min-w-0 items-center gap-[var(--ui-input-select-global-box-gap)] rounded-[var(--ui-input-select-global-box-border-radius)] border bg-[var(--ui-input-select-global-box-color-idle)] border-[var(--ui-input-select-normal-box-border-color-idle)] px-[var(--ui-input-select-global-box-padding-x)] text-sm leading-6 transition-colors',\n 'not-has-disabled:hover:bg-[var(--ui-input-select-global-box-color-hover)] not-has-disabled:hover:border-[var(--ui-input-select-normal-box-border-color-hover)]',\n 'has-[input:focus-visible]:border-[var(--ui-input-select-normal-box-border-color-hover)] has-[input:focus-visible]:ring-[3px] has-[input:focus-visible]:ring-[var(--ui-focus-primary)]',\n 'has-disabled:cursor-not-allowed has-disabled:border-[var(--ui-input-select-normal-box-border-color-disabled)] has-disabled:bg-[var(--ui-input-select-global-box-color-disabled)]',\n 'has-[input[aria-invalid=true]]:border-[var(--ui-input-select-error-box-border-color-idle)] has-[input[aria-invalid=true]:focus-visible]:ring-[var(--ui-focus-error)]',\n containerClassName\n )}\n >\n <ComboboxPrimitive.Input\n ref={ref}\n className={cn(\n 'min-w-0 flex-1 bg-transparent text-[var(--ui-input-select-global-value-color-idle)] outline-none placeholder:text-[var(--ui-input-select-global-placeholder-color-idle)] disabled:cursor-not-allowed disabled:text-[var(--ui-input-select-global-value-color-disabled)]',\n className\n )}\n {...props}\n />\n {clearable && (\n <ComboboxPrimitive.Clear\n aria-label=\"Clear\"\n className=\"flex shrink-0 cursor-pointer items-center text-[var(--ui-input-select-normal-icon-expand-color-idle)] outline-none focus-visible:ring-[3px] focus-visible:ring-[var(--ui-focus-primary)] data-[disabled]:hidden\"\n >\n <TimesIcon size={16} />\n </ComboboxPrimitive.Clear>\n )}\n <ComboboxPrimitive.Trigger\n aria-label=\"Toggle\"\n className=\"flex shrink-0 cursor-pointer items-center text-[var(--ui-input-select-normal-icon-expand-color-idle)] outline-none group-has-disabled:text-[var(--ui-input-select-normal-icon-expand-color-disabled)]\"\n >\n <ChevronDownIcon\n size={16}\n className=\"transition-transform group-has-[input[aria-expanded=true]]:rotate-180\"\n />\n </ComboboxPrimitive.Trigger>\n </ComboboxPrimitive.InputGroup>\n));\nComboboxInput.displayName = 'ComboboxInput';\n\nexport interface ComboboxContentProps\n extends React.ComponentPropsWithoutRef<typeof ComboboxPrimitive.Popup> {\n sideOffset?: number;\n align?: ComboboxPrimitive.Positioner.Props['align'];\n side?: ComboboxPrimitive.Positioner.Props['side'];\n /** Container to portal into (e.g. a shadow root, so the popup inherits styles). */\n portalContainer?: ComboboxPrimitive.Portal.Props['container'];\n}\n\nconst ComboboxContent = React.forwardRef<\n React.ElementRef<typeof ComboboxPrimitive.Popup>,\n ComboboxContentProps\n>(\n (\n { className, children, sideOffset = 4, align = 'start', side = 'bottom', portalContainer, ...props },\n ref\n ) => (\n <ComboboxPrimitive.Portal container={portalContainer}>\n <ComboboxPrimitive.Positioner\n sideOffset={sideOffset}\n align={align}\n side={side}\n className=\"z-50 outline-none\"\n >\n <ComboboxPrimitive.Popup\n ref={ref}\n className={cn(\n 'max-h-[var(--available-height)] min-w-[var(--anchor-width)] overflow-y-auto rounded-[var(--ui-input-select-dropdown-container-border-radius)] border border-[var(--ui-input-select-dropdown-container-border-color)] bg-[var(--ui-input-select-dropdown-container-color)] py-[var(--ui-input-select-dropdown-container-padding-y)] text-sm shadow-md outline-none',\n className\n )}\n {...props}\n >\n {children}\n </ComboboxPrimitive.Popup>\n </ComboboxPrimitive.Positioner>\n </ComboboxPrimitive.Portal>\n )\n);\nComboboxContent.displayName = 'ComboboxContent';\n\nconst ComboboxList = React.forwardRef<\n React.ElementRef<typeof ComboboxPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof ComboboxPrimitive.List>\n>(({ className, ...props }, ref) => (\n <ComboboxPrimitive.List\n ref={ref}\n className={cn('flex flex-col', className)}\n {...props}\n />\n));\nComboboxList.displayName = 'ComboboxList';\n\nconst ComboboxItem = React.forwardRef<\n React.ElementRef<typeof ComboboxPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof ComboboxPrimitive.Item>\n>(({ className, children, ...props }, ref) => (\n <ComboboxPrimitive.Item\n ref={ref}\n className={cn(\n 'relative flex cursor-default items-center gap-[var(--ui-input-select-dropdown-item-global-container-gap)] px-[var(--ui-input-select-dropdown-item-global-container-padding-x)] py-[var(--ui-input-select-dropdown-item-global-container-padding-y)] leading-6 text-[var(--ui-input-select-dropdown-item-global-label-color)] outline-none select-none',\n 'bg-[var(--ui-input-select-dropdown-item-unselected-container-color-idle)] data-[highlighted]:bg-[var(--ui-input-select-dropdown-item-unselected-container-color-hover)]',\n 'data-[selected]:bg-[var(--ui-input-select-dropdown-item-selected-container-color-idle)] data-[selected]:data-[highlighted]:bg-[var(--ui-input-select-dropdown-item-selected-container-color-hover)]',\n 'data-[disabled]:pointer-events-none data-[disabled]:bg-[var(--ui-input-select-dropdown-item-unselected-container-color-disabled)]',\n className\n )}\n {...props}\n >\n <span className=\"min-w-0 flex-1 truncate\">{children}</span>\n <ComboboxPrimitive.ItemIndicator className=\"flex shrink-0 items-center text-[var(--ui-input-select-normal-icon-expand-color-hover)]\">\n <CheckIcon size={16} />\n </ComboboxPrimitive.ItemIndicator>\n </ComboboxPrimitive.Item>\n));\nComboboxItem.displayName = 'ComboboxItem';\n\nconst ComboboxEmpty = React.forwardRef<\n React.ElementRef<typeof ComboboxPrimitive.Empty>,\n React.ComponentPropsWithoutRef<typeof ComboboxPrimitive.Empty>\n>(({ className, ...props }, ref) => (\n <ComboboxPrimitive.Empty\n ref={ref}\n className={cn(\n 'px-[var(--ui-input-select-dropdown-item-global-container-padding-x)] py-[var(--ui-input-select-dropdown-item-global-container-padding-y)] text-center text-sm leading-6 text-[var(--ui-input-select-normal-description-color-idle)] empty:m-0 empty:p-0',\n className\n )}\n {...props}\n />\n));\nComboboxEmpty.displayName = 'ComboboxEmpty';\n\nconst ComboboxGroup = ComboboxPrimitive.Group;\n\nconst ComboboxGroupLabel = React.forwardRef<\n React.ElementRef<typeof ComboboxPrimitive.GroupLabel>,\n React.ComponentPropsWithoutRef<typeof ComboboxPrimitive.GroupLabel>\n>(({ className, ...props }, ref) => (\n <ComboboxPrimitive.GroupLabel\n ref={ref}\n className={cn(\n 'px-[var(--ui-input-select-dropdown-section-container-header-padding-x)] py-[var(--ui-input-select-dropdown-section-container-header-padding-y)] text-sm font-semibold leading-6 text-[var(--ui-input-select-dropdown-section-label-group-color)]',\n className\n )}\n {...props}\n />\n));\nComboboxGroupLabel.displayName = 'ComboboxGroupLabel';\n\nexport {\n Combobox,\n ComboboxInput,\n ComboboxContent,\n ComboboxList,\n ComboboxItem,\n ComboboxEmpty,\n ComboboxGroup,\n ComboboxGroupLabel,\n};\n"],"names":["Combobox","props","jsx","ComboboxPrimitive","ComboboxInput","React","className","containerClassName","clearable","ref","jsxs","cn","TimesIcon","ChevronDownIcon","ComboboxContent","children","sideOffset","align","side","portalContainer","ComboboxList","ComboboxItem","CheckIcon","ComboboxEmpty","ComboboxGroup","ComboboxGroupLabel"],"mappings":";;;;;AAmBA,SAASA,EACPC,GACA;AACA,SAAO,gBAAAC,EAACC,EAAkB,MAAlB,EAAwB,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A,EAAlB;AAAA,IACC,KAAAM;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAL;AAAA,IAAA;AAAA,IAED,GAAGL;AAAA,EAAA;AACN,CACD;AACDsB,EAAc,cAAc;AAE5B,MAAMC,IAAgBrB,EAAkB,OAElCsB,IAAqBpB,EAAM,WAG/B,CAAC,EAAE,WAAAC,GAAW,GAAGL,EAAA,GAASQ,MAC1B,gBAAAP;AAAA,EAACC,EAAkB;AAAA,EAAlB;AAAA,IACC,KAAAM;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACAL;AAAA,IAAA;AAAA,IAED,GAAGL;AAAA,EAAA;AACN,CACD;AACDwB,EAAmB,cAAc;"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { jsx as a, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { Field as r } from "@base-ui/react/field";
|
|
3
|
+
import { cva as n } from "../../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js";
|
|
4
|
+
import { cn as l } from "../../../lib/utils.js";
|
|
5
|
+
import { Separator as d } from "../separator/separator.js";
|
|
6
|
+
import { labelClassName as s } from "../label/label.js";
|
|
7
|
+
const f = n(
|
|
8
|
+
"group/field flex w-full gap-3 data-[invalid]:text-[var(--ui-text-on-status-danger)]",
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
orientation: {
|
|
12
|
+
vertical: "flex-col [&>*]:w-full [&>.sr-only]:w-auto",
|
|
13
|
+
horizontal: "flex-row items-center [&>[data-slot=field-label]]:flex-auto",
|
|
14
|
+
responsive: "flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto @md/field-group:[&>[data-slot=field-label]]:flex-auto"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
orientation: "vertical"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
function v({ className: e, orientation: t = "vertical", ...o }) {
|
|
23
|
+
return /* @__PURE__ */ a(
|
|
24
|
+
r.Root,
|
|
25
|
+
{
|
|
26
|
+
"data-slot": "field",
|
|
27
|
+
"data-orientation": t,
|
|
28
|
+
className: l(f({ orientation: t }), e),
|
|
29
|
+
...o
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
function b({ className: e, ...t }) {
|
|
34
|
+
return /* @__PURE__ */ a(
|
|
35
|
+
r.Label,
|
|
36
|
+
{
|
|
37
|
+
"data-slot": "field-label",
|
|
38
|
+
className: l(
|
|
39
|
+
s,
|
|
40
|
+
"flex w-fit items-center gap-2 leading-snug group-data-[disabled]/field:opacity-50",
|
|
41
|
+
e
|
|
42
|
+
),
|
|
43
|
+
...t
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
function N({ className: e, ...t }) {
|
|
48
|
+
return /* @__PURE__ */ a(
|
|
49
|
+
r.Control,
|
|
50
|
+
{
|
|
51
|
+
"data-slot": "field-control",
|
|
52
|
+
className: l(e),
|
|
53
|
+
...t
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
function F({ className: e, ...t }) {
|
|
58
|
+
return /* @__PURE__ */ a(
|
|
59
|
+
r.Description,
|
|
60
|
+
{
|
|
61
|
+
"data-slot": "field-description",
|
|
62
|
+
className: l(
|
|
63
|
+
"text-sm font-normal leading-normal text-muted-foreground",
|
|
64
|
+
"[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-[var(--ui-background-brand-secondary)]",
|
|
65
|
+
e
|
|
66
|
+
),
|
|
67
|
+
...t
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
function w({ className: e, ...t }) {
|
|
72
|
+
return /* @__PURE__ */ a(
|
|
73
|
+
r.Error,
|
|
74
|
+
{
|
|
75
|
+
"data-slot": "field-error",
|
|
76
|
+
className: l(
|
|
77
|
+
"text-sm font-normal text-[var(--ui-text-on-status-danger)]",
|
|
78
|
+
e
|
|
79
|
+
),
|
|
80
|
+
...t
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
function y({ className: e, ...t }) {
|
|
85
|
+
return /* @__PURE__ */ a(
|
|
86
|
+
"fieldset",
|
|
87
|
+
{
|
|
88
|
+
"data-slot": "field-set",
|
|
89
|
+
className: l(
|
|
90
|
+
"flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
|
|
91
|
+
e
|
|
92
|
+
),
|
|
93
|
+
...t
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
function h({
|
|
98
|
+
className: e,
|
|
99
|
+
variant: t = "legend",
|
|
100
|
+
...o
|
|
101
|
+
}) {
|
|
102
|
+
return /* @__PURE__ */ a(
|
|
103
|
+
"legend",
|
|
104
|
+
{
|
|
105
|
+
"data-slot": "field-legend",
|
|
106
|
+
"data-variant": t,
|
|
107
|
+
className: l(
|
|
108
|
+
"mb-3 font-medium data-[variant=legend]:text-base data-[variant=label]:text-sm",
|
|
109
|
+
e
|
|
110
|
+
),
|
|
111
|
+
...o
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
function k({ className: e, ...t }) {
|
|
116
|
+
return /* @__PURE__ */ a(
|
|
117
|
+
"div",
|
|
118
|
+
{
|
|
119
|
+
"data-slot": "field-group",
|
|
120
|
+
className: l(
|
|
121
|
+
"group/field-group @container/field-group flex w-full flex-col gap-7 [&>[data-slot=field-group]]:gap-4",
|
|
122
|
+
e
|
|
123
|
+
),
|
|
124
|
+
...t
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
function C({ className: e, ...t }) {
|
|
129
|
+
return /* @__PURE__ */ a(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
"data-slot": "field-content",
|
|
133
|
+
className: l(
|
|
134
|
+
"group/field-content flex flex-1 flex-col gap-1.5 leading-snug",
|
|
135
|
+
e
|
|
136
|
+
),
|
|
137
|
+
...t
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
function L({ className: e, ...t }) {
|
|
142
|
+
return /* @__PURE__ */ a(
|
|
143
|
+
"div",
|
|
144
|
+
{
|
|
145
|
+
"data-slot": "field-title",
|
|
146
|
+
className: l(
|
|
147
|
+
"flex w-fit items-center gap-2 text-sm font-medium leading-snug group-data-[disabled]/field:opacity-50",
|
|
148
|
+
e
|
|
149
|
+
),
|
|
150
|
+
...t
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
function S({ children: e, className: t, ...o }) {
|
|
155
|
+
return /* @__PURE__ */ i(
|
|
156
|
+
"div",
|
|
157
|
+
{
|
|
158
|
+
"data-slot": "field-separator",
|
|
159
|
+
"data-content": !!e,
|
|
160
|
+
className: l("relative -my-2 h-5 text-sm", t),
|
|
161
|
+
...o,
|
|
162
|
+
children: [
|
|
163
|
+
/* @__PURE__ */ a(d, { className: "absolute inset-0 top-1/2" }),
|
|
164
|
+
e && /* @__PURE__ */ a(
|
|
165
|
+
"span",
|
|
166
|
+
{
|
|
167
|
+
"data-slot": "field-separator-content",
|
|
168
|
+
className: "relative mx-auto block w-fit bg-background px-2 text-muted-foreground",
|
|
169
|
+
children: e
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
export {
|
|
177
|
+
v as Field,
|
|
178
|
+
C as FieldContent,
|
|
179
|
+
N as FieldControl,
|
|
180
|
+
F as FieldDescription,
|
|
181
|
+
w as FieldError,
|
|
182
|
+
k as FieldGroup,
|
|
183
|
+
b as FieldLabel,
|
|
184
|
+
h as FieldLegend,
|
|
185
|
+
S as FieldSeparator,
|
|
186
|
+
y as FieldSet,
|
|
187
|
+
L as FieldTitle
|
|
188
|
+
};
|
|
189
|
+
//# sourceMappingURL=field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field.js","sources":["../../../../src/components/ui/field/field.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Field as FieldPrimitive } from '@base-ui/react/field';\nimport { cva, type VariantProps } from 'class-variance-authority';\n\nimport { cn } from '@/lib/utils';\nimport { labelClassName } from '../label';\nimport { Separator } from '../separator';\n\n// Ported from `@acronis-platform/shadcn-uikit`'s `field`\n// (packages/ui-legacy/src/components/ui/field.tsx), rebuilt on Base UI's `Field`\n// primitive. `Field` (Root) / `FieldLabel` / `FieldControl` / `FieldDescription` /\n// `FieldError` auto-wire the label↔control↔description↔error associations and\n// expose Base UI's validity state — no manual `htmlFor`/`id`/`aria-*`. The\n// structural parts (`FieldSet`, `FieldLegend`, `FieldGroup`, `FieldContent`,\n// `FieldTitle`, `FieldSeparator`) are styled markup (Base UI has no equivalent).\n// Field pairs with the *bare* controls — `InputBox`, `Checkbox`, `Switch`,\n// `RadioGroup` — not the self-contained `InputText`/`InputSearch` fields.\n\nconst fieldVariants = cva(\n 'group/field flex w-full gap-3 data-[invalid]:text-[var(--ui-text-on-status-danger)]',\n {\n variants: {\n orientation: {\n vertical: 'flex-col [&>*]:w-full [&>.sr-only]:w-auto',\n horizontal:\n 'flex-row items-center [&>[data-slot=field-label]]:flex-auto',\n responsive:\n 'flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto @md/field-group:[&>[data-slot=field-label]]:flex-auto',\n },\n },\n defaultVariants: {\n orientation: 'vertical',\n },\n }\n);\n\nexport interface FieldProps\n extends Omit<React.ComponentProps<typeof FieldPrimitive.Root>, 'className'>,\n VariantProps<typeof fieldVariants> {\n className?: string;\n}\n\nfunction Field({ className, orientation = 'vertical', ...props }: FieldProps) {\n return (\n <FieldPrimitive.Root\n data-slot=\"field\"\n data-orientation={orientation}\n className={cn(fieldVariants({ orientation }), className)}\n {...props}\n />\n );\n}\n\nexport interface FieldLabelProps\n extends Omit<React.ComponentProps<typeof FieldPrimitive.Label>, 'className'> {\n className?: string;\n}\n\nfunction FieldLabel({ className, ...props }: FieldLabelProps) {\n return (\n <FieldPrimitive.Label\n data-slot=\"field-label\"\n className={cn(\n labelClassName,\n 'flex w-fit items-center gap-2 leading-snug group-data-[disabled]/field:opacity-50',\n className\n )}\n {...props}\n />\n );\n}\n\nexport interface FieldControlProps\n extends Omit<React.ComponentProps<typeof FieldPrimitive.Control>, 'className'> {\n className?: string;\n}\n\n// Thin wrapper over Base UI's Field.Control — usually used with `render` to wire\n// a bare ui-react control (e.g. `<FieldControl render={<InputBox />} />`), which\n// receives the field's id / aria-describedby / name automatically.\nfunction FieldControl({ className, ...props }: FieldControlProps) {\n return (\n <FieldPrimitive.Control\n data-slot=\"field-control\"\n className={cn(className)}\n {...props}\n />\n );\n}\n\nexport interface FieldDescriptionProps\n extends Omit<\n React.ComponentProps<typeof FieldPrimitive.Description>,\n 'className'\n > {\n className?: string;\n}\n\nfunction FieldDescription({ className, ...props }: FieldDescriptionProps) {\n return (\n <FieldPrimitive.Description\n data-slot=\"field-description\"\n className={cn(\n 'text-sm font-normal leading-normal text-muted-foreground',\n '[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-[var(--ui-background-brand-secondary)]',\n className\n )}\n {...props}\n />\n );\n}\n\nexport interface FieldErrorProps\n extends Omit<React.ComponentProps<typeof FieldPrimitive.Error>, 'className'> {\n className?: string;\n}\n\nfunction FieldError({ className, ...props }: FieldErrorProps) {\n return (\n <FieldPrimitive.Error\n data-slot=\"field-error\"\n className={cn(\n 'text-sm font-normal text-[var(--ui-text-on-status-danger)]',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction FieldSet({ className, ...props }: React.ComponentProps<'fieldset'>) {\n return (\n <fieldset\n data-slot=\"field-set\"\n className={cn(\n 'flex flex-col gap-6 has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3',\n className\n )}\n {...props}\n />\n );\n}\n\nexport interface FieldLegendProps extends React.ComponentProps<'legend'> {\n variant?: 'legend' | 'label';\n}\n\nfunction FieldLegend({\n className,\n variant = 'legend',\n ...props\n}: FieldLegendProps) {\n return (\n <legend\n data-slot=\"field-legend\"\n data-variant={variant}\n className={cn(\n 'mb-3 font-medium data-[variant=legend]:text-base data-[variant=label]:text-sm',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction FieldGroup({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-group\"\n className={cn(\n 'group/field-group @container/field-group flex w-full flex-col gap-7 [&>[data-slot=field-group]]:gap-4',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction FieldContent({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-content\"\n className={cn(\n 'group/field-content flex flex-1 flex-col gap-1.5 leading-snug',\n className\n )}\n {...props}\n />\n );\n}\n\nfunction FieldTitle({ className, ...props }: React.ComponentProps<'div'>) {\n return (\n <div\n data-slot=\"field-title\"\n className={cn(\n 'flex w-fit items-center gap-2 text-sm font-medium leading-snug group-data-[disabled]/field:opacity-50',\n className\n )}\n {...props}\n />\n );\n}\n\nexport interface FieldSeparatorProps extends React.ComponentProps<'div'> {\n children?: React.ReactNode;\n}\n\nfunction FieldSeparator({ children, className, ...props }: FieldSeparatorProps) {\n return (\n <div\n data-slot=\"field-separator\"\n data-content={!!children}\n className={cn('relative -my-2 h-5 text-sm', className)}\n {...props}\n >\n <Separator className=\"absolute inset-0 top-1/2\" />\n {children && (\n <span\n data-slot=\"field-separator-content\"\n className=\"relative mx-auto block w-fit bg-background px-2 text-muted-foreground\"\n >\n {children}\n </span>\n )}\n </div>\n );\n}\n\nexport {\n Field,\n FieldLabel,\n FieldControl,\n FieldDescription,\n FieldError,\n FieldSet,\n FieldLegend,\n FieldGroup,\n FieldContent,\n FieldTitle,\n FieldSeparator,\n};\n"],"names":["fieldVariants","cva","Field","className","orientation","props","jsx","FieldPrimitive","cn","FieldLabel","labelClassName","FieldControl","FieldDescription","FieldError","FieldSet","FieldLegend","variant","FieldGroup","FieldContent","FieldTitle","FieldSeparator","children","jsxs","Separator"],"mappings":";;;;;;AAoBA,MAAMA,IAAgBC;AAAA,EACpB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,aAAa;AAAA,QACX,UAAU;AAAA,QACV,YACE;AAAA,QACF,YACE;AAAA,MAAA;AAAA,IACJ;AAAA,IAEF,iBAAiB;AAAA,MACf,aAAa;AAAA,IAAA;AAAA,EACf;AAEJ;AAQA,SAASC,EAAM,EAAE,WAAAC,GAAW,aAAAC,IAAc,YAAY,GAAGC,KAAqB;AAC5E,SACE,gBAAAC;AAAA,IAACC,EAAe;AAAA,IAAf;AAAA,MACC,aAAU;AAAA,MACV,oBAAkBH;AAAA,MAClB,WAAWI,EAAGR,EAAc,EAAE,aAAAI,EAAA,CAAa,GAAGD,CAAS;AAAA,MACtD,GAAGE;AAAA,IAAA;AAAA,EAAA;AAGV;AAOA,SAASI,EAAW,EAAE,WAAAN,GAAW,GAAGE,KAA0B;AAC5D,SACE,gBAAAC;AAAA,IAACC,EAAe;AAAA,IAAf;AAAA,MACC,aAAU;AAAA,MACV,WAAWC;AAAA,QACTE;AAAA,QACA;AAAA,QACAP;AAAA,MAAA;AAAA,MAED,GAAGE;AAAA,IAAA;AAAA,EAAA;AAGV;AAUA,SAASM,EAAa,EAAE,WAAAR,GAAW,GAAGE,KAA4B;AAChE,SACE,gBAAAC;AAAA,IAACC,EAAe;AAAA,IAAf;AAAA,MACC,aAAU;AAAA,MACV,WAAWC,EAAGL,CAAS;AAAA,MACtB,GAAGE;AAAA,IAAA;AAAA,EAAA;AAGV;AAUA,SAASO,EAAiB,EAAE,WAAAT,GAAW,GAAGE,KAAgC;AACxE,SACE,gBAAAC;AAAA,IAACC,EAAe;AAAA,IAAf;AAAA,MACC,aAAU;AAAA,MACV,WAAWC;AAAA,QAC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,EAAW,EAAE,WAAAhB,GAAW,GAAGE,KAAsC;AACxE,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAWE;AAAA,QACT;AAAA,QACAL;AAAA,MAAA;AAAA,MAED,GAAGE;AAAA,IAAA;AAAA,EAAA;AAGV;AAMA,SAASe,EAAe,EAAE,UAAAC,GAAU,WAAAlB,GAAW,GAAGE,KAA8B;AAC9E,SACE,gBAAAiB;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,aAAU;AAAA,MACV,gBAAc,CAAC,CAACD;AAAA,MAChB,WAAWb,EAAG,8BAA8BL,CAAS;AAAA,MACpD,GAAGE;AAAA,MAEJ,UAAA;AAAA,QAAA,gBAAAC,EAACiB,GAAA,EAAU,WAAU,2BAAA,CAA2B;AAAA,QAC/CF,KACC,gBAAAf;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,aAAU;AAAA,YACV,WAAU;AAAA,YAET,UAAAe;AAAA,UAAA;AAAA,QAAA;AAAA,MACH;AAAA,IAAA;AAAA,EAAA;AAIR;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { Form as f } from "@base-ui/react/form";
|
|
3
|
+
import { cn as l } from "../../../lib/utils.js";
|
|
4
|
+
function a({ className: o, ...r }) {
|
|
5
|
+
return /* @__PURE__ */ m(
|
|
6
|
+
f,
|
|
7
|
+
{
|
|
8
|
+
className: l("flex w-full flex-col gap-6", o),
|
|
9
|
+
...r
|
|
10
|
+
}
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
a as Form
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.js","sources":["../../../../src/components/ui/form/form.tsx"],"sourcesContent":["'use client';\n\nimport {\n Form as FormPrimitive,\n type FormProps as BaseFormProps,\n} from '@base-ui/react/form';\n\nimport { cn } from '@/lib/utils';\n\n// Ported from `@acronis-platform/shadcn-uikit`'s `form`\n// (packages/ui-legacy/src/components/ui/form.tsx), rebuilt on Base UI's Form.\n// The legacy form was a react-hook-form wrapper (FormProvider/Controller); this\n// version drops that dependency and coordinates the ui-react `Field`s directly via\n// Base UI's native form: it collects values by each Field's `name`, runs their\n// validation on submit (or per `validationMode`), surfaces server `errors` keyed\n// by field name, and calls `onFormSubmit(values)` only when all fields are valid.\nexport interface FormProps<\n FormValues extends Record<string, unknown> = Record<string, unknown>,\n> extends Omit<BaseFormProps<FormValues>, 'className'> {\n className?: string;\n}\n\nfunction Form<\n FormValues extends Record<string, unknown> = Record<string, unknown>,\n>({ className, ...props }: FormProps<FormValues>) {\n return (\n <FormPrimitive\n className={cn('flex w-full flex-col gap-6', className)}\n {...props}\n />\n );\n}\n\nexport { Form };\n"],"names":["Form","className","props","jsx","FormPrimitive","cn"],"mappings":";;;AAsBA,SAASA,EAEP,EAAE,WAAAC,GAAW,GAAGC,KAAgC;AAChD,SACE,gBAAAC;AAAA,IAACC;AAAAA,IAAA;AAAA,MACC,WAAWC,EAAG,8BAA8BJ,CAAS;AAAA,MACpD,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
import { cn as m } from "../../../lib/utils.js";
|
|
4
|
+
const s = t.forwardRef(
|
|
5
|
+
({ className: e, ...a }, o) => /* @__PURE__ */ r(
|
|
6
|
+
"div",
|
|
7
|
+
{
|
|
8
|
+
ref: o,
|
|
9
|
+
"data-slot": "skeleton",
|
|
10
|
+
className: m(
|
|
11
|
+
"animate-pulse rounded-md bg-[var(--ui-background-surface-active)]",
|
|
12
|
+
e
|
|
13
|
+
),
|
|
14
|
+
...a
|
|
15
|
+
}
|
|
16
|
+
)
|
|
17
|
+
);
|
|
18
|
+
s.displayName = "Skeleton";
|
|
19
|
+
export {
|
|
20
|
+
s as Skeleton
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=skeleton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skeleton.js","sources":["../../../../src/components/ui/skeleton/skeleton.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { cn } from '@/lib/utils';\n\n// Ported from `@acronis-platform/shadcn-uikit`'s `skeleton`\n// (packages/ui-legacy/src/components/ui/skeleton.tsx). A pulsing placeholder box\n// for loading states — no Base UI primitive, just a styled `<div>`. The legacy\n// `bg-muted` (--ui-background-surface-secondary) is near-white and nearly\n// invisible on a white surface, so the fill uses the more visible\n// `--ui-background-surface-active` gray (still subtle in dark). Shape and size\n// come from the caller's className.\nexport type SkeletonProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst Skeleton = React.forwardRef<HTMLDivElement, SkeletonProps>(\n ({ className, ...props }, ref) => (\n <div\n ref={ref}\n data-slot=\"skeleton\"\n className={cn(\n 'animate-pulse rounded-md bg-[var(--ui-background-surface-active)]',\n className\n )}\n {...props}\n />\n )\n);\nSkeleton.displayName = 'Skeleton';\n\nexport { Skeleton };\n"],"names":["Skeleton","React","className","props","ref","jsx","cn"],"mappings":";;;AAaA,MAAMA,IAAWC,EAAM;AAAA,EACrB,CAAC,EAAE,WAAAC,GAAW,GAAGC,EAAA,GAASC,MACxB,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAD;AAAA,MACA,aAAU;AAAA,MACV,WAAWE;AAAA,QACT;AAAA,QACAJ;AAAA,MAAA;AAAA,MAED,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;AACAH,EAAS,cAAc;"}
|