@cboxdk/cbox-ui 0.15.5 → 0.15.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -2
- package/dist/index.js +96 -108
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { ReactNode, ComponentType, FormEvent, AnchorHTMLAttributes, ComponentProps, ButtonHTMLAttributes, InputHTMLAttributes, TextareaHTMLAttributes } from 'react';
|
|
3
|
+
import { ReactNode, ComponentType, FormEvent, AnchorHTMLAttributes, ComponentProps, AriaAttributes, ButtonHTMLAttributes, InputHTMLAttributes, TextareaHTMLAttributes } from 'react';
|
|
4
4
|
import { C as CboxThemeMode, a as CboxKnownApp } from './catalog-BroZWvws.js';
|
|
5
5
|
export { b as CboxAppCatalogState, c as CboxCatalogApp, d as authorizeHref, p as parseAppCatalog, r as readKnownAppCatalog, e as rememberAppCatalog, s as secureIconUrl, f as signInTarget } from './catalog-BroZWvws.js';
|
|
6
6
|
import { LucideIcon } from 'lucide-react';
|
|
@@ -1119,7 +1119,7 @@ type LinkComp = ComponentType<{
|
|
|
1119
1119
|
className?: string;
|
|
1120
1120
|
children: ReactNode;
|
|
1121
1121
|
}>;
|
|
1122
|
-
type CommonProps = {
|
|
1122
|
+
type CommonProps = Pick<AriaAttributes, 'aria-describedby' | 'aria-invalid'> & {
|
|
1123
1123
|
/** Options or grouped options. Pass an array of either shape. */
|
|
1124
1124
|
items: ComboboxOption[] | ComboboxGroup[];
|
|
1125
1125
|
/** Placeholder shown in the trigger when no value is selected. */
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { defineCboxAppSwitcher, subscribeKnownAppCatalog, readKnownAppCatalog, s
|
|
|
4
4
|
export { authorizeHref, parseAppCatalog, readKnownAppCatalog, rememberAppCatalog, secureIconUrl, signInTarget } from './chunk-AJCYF7SS.js';
|
|
5
5
|
import { createContext, forwardRef, Children, isValidElement, cloneElement, useContext, useMemo, useSyncExternalStore, useState, useId, useRef, useCallback, useEffect, createElement, useLayoutEffect, useImperativeHandle } from 'react';
|
|
6
6
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
7
|
-
import { Zap, Webhook, Wallet, Users, Timer, Tag, Sparkles, ShieldCheck, Shield, Settings, Server, Send, Search, Rocket, Receipt, Plug, Percent, Package, Network, MessageSquare, Mail, Lock, List, LifeBuoy, Layers, LayoutGrid, LayoutDashboard, Key, Inbox, Home, HardDrive, Globe, GitBranch, Folder, FileText, Database, CreditCard, Code, Cloud, Clock, Calendar, Building2, Briefcase, Boxes, BookOpen, Bell, BarChart3, Activity, ChevronDown, Plus, PinOff, Pin, PanelLeftOpen, PanelLeftClose, ChevronsUpDown, CircleHelp, ArrowLeftRight, CornerDownLeft, ArrowRight, MoreHorizontal, CircleAlert, ChevronRight, Ticket, ArrowUpRight, UserRound, ChevronLeft,
|
|
7
|
+
import { Zap, Webhook, Wallet, Users, Timer, Tag, Sparkles, ShieldCheck, Shield, Settings, Server, Send, Search, Rocket, Receipt, Plug, Percent, Package, Network, MessageSquare, Mail, Lock, List, LifeBuoy, Layers, LayoutGrid, LayoutDashboard, Key, Inbox, Home, HardDrive, Globe, GitBranch, Folder, FileText, Database, CreditCard, Code, Cloud, Clock, Calendar, Building2, Briefcase, Boxes, BookOpen, Bell, BarChart3, Activity, ChevronDown, Plus, PinOff, Pin, PanelLeftOpen, PanelLeftClose, ChevronsUpDown, CircleHelp, ArrowLeftRight, CornerDownLeft, ArrowRight, MoreHorizontal, CircleAlert, ChevronRight, Ticket, ArrowUpRight, UserRound, ChevronLeft, ArrowLeft, X, Circle, Monitor, Sun, Moon, LogOut, Check, ArrowUp } from 'lucide-react';
|
|
8
8
|
import { createPortal } from 'react-dom';
|
|
9
9
|
|
|
10
10
|
var CboxIdContext = createContext(null);
|
|
@@ -2713,67 +2713,46 @@ function HelpColumn({ docked, mobile = false }) {
|
|
|
2713
2713
|
const onScroll = (top) => {
|
|
2714
2714
|
if (view !== "chat") store.set({ scrollTop: top });
|
|
2715
2715
|
};
|
|
2716
|
-
|
|
2717
|
-
return /* @__PURE__ */ jsx("div", { ref: scrim, className: "cbx-overlay cbx-sheet-backdrop", hidden: !open, ...scrimHandlers(close), children: /* @__PURE__ */ jsxs(
|
|
2718
|
-
"div",
|
|
2719
|
-
{
|
|
2720
|
-
ref: column,
|
|
2721
|
-
id: "cbx-help",
|
|
2722
|
-
className: "cbx-sheet cbx-sheet-bottom is-tall cbx-help-sheet",
|
|
2723
|
-
role: "dialog",
|
|
2724
|
-
"aria-modal": "true",
|
|
2725
|
-
"aria-label": t("Help with {page}", { page: topic }),
|
|
2726
|
-
tabIndex: -1,
|
|
2727
|
-
onKeyDown: (event) => {
|
|
2728
|
-
if (event.key === "Escape" && !event.defaultPrevented) {
|
|
2729
|
-
event.preventDefault();
|
|
2730
|
-
close();
|
|
2731
|
-
}
|
|
2732
|
-
trapTab(event, column.current);
|
|
2733
|
-
},
|
|
2734
|
-
children: [
|
|
2735
|
-
/* @__PURE__ */ jsx("div", { className: "cbx-sheet-handle cbx-sheet-grab", "aria-hidden": "true" }),
|
|
2736
|
-
/* @__PURE__ */ jsxs("div", { className: `cbx-sheet-head cbx-sheet-grab ${view !== "home" ? "has-back" : ""}`, children: [
|
|
2737
|
-
view !== "home" && /* @__PURE__ */ jsx("button", { type: "button", className: "cbx-sheet-back", onClick: back, "aria-label": t("Back to Help"), children: /* @__PURE__ */ jsx(ChevronLeft, { size: 20, strokeWidth: 1.8, "aria-hidden": true }) }),
|
|
2738
|
-
/* @__PURE__ */ jsx("h2", { className: "cbx-sheet-title cbx-truncate", children: view === "article" ? t("Article") : view === "chat" ? t("Ask Cbox") : t("Help with {page}", { page: topic }) }),
|
|
2739
|
-
/* @__PURE__ */ jsx("button", { type: "button", className: "cbx-icon-button", onClick: close, "aria-label": t("Close Help"), children: /* @__PURE__ */ jsx(X, { size: 18, strokeWidth: 1.8, "aria-hidden": true }) })
|
|
2740
|
-
] }),
|
|
2741
|
-
view === "chat" && context(true),
|
|
2742
|
-
/* @__PURE__ */ jsx("div", { ref: body, className: `cbx-sheet-body ${view === "chat" ? "is-chat" : ""}`, "data-cbx-sheet-scroll": "", onScroll: (event) => onScroll(event.currentTarget.scrollTop), children: content }),
|
|
2743
|
-
foot
|
|
2744
|
-
]
|
|
2745
|
-
}
|
|
2746
|
-
) });
|
|
2747
|
-
}
|
|
2748
|
-
return /* @__PURE__ */ jsxs(
|
|
2716
|
+
return /* @__PURE__ */ jsx(
|
|
2749
2717
|
"div",
|
|
2750
2718
|
{
|
|
2751
|
-
ref:
|
|
2752
|
-
|
|
2753
|
-
|
|
2719
|
+
ref: scrim,
|
|
2720
|
+
className: mobile ? "cbx-overlay cbx-sheet-backdrop" : void 0,
|
|
2721
|
+
style: mobile ? void 0 : { display: "contents" },
|
|
2754
2722
|
hidden: !open,
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2723
|
+
...mobile ? scrimHandlers(close) : {},
|
|
2724
|
+
children: /* @__PURE__ */ jsxs(
|
|
2725
|
+
"div",
|
|
2726
|
+
{
|
|
2727
|
+
ref: column,
|
|
2728
|
+
id: "cbx-help",
|
|
2729
|
+
className: mobile ? "cbx-sheet cbx-sheet-bottom is-tall cbx-help-sheet" : `cbx-help ${docked ? "is-docked" : "is-overlay"}`,
|
|
2730
|
+
hidden: !open,
|
|
2731
|
+
"data-restored": !mobile && restored ? "true" : void 0,
|
|
2732
|
+
"aria-label": mobile ? t("Help with {page}", { page: topic }) : t("Help"),
|
|
2733
|
+
role: !mobile && docked ? "complementary" : "dialog",
|
|
2734
|
+
"aria-modal": !mobile && docked ? void 0 : true,
|
|
2735
|
+
tabIndex: -1,
|
|
2736
|
+
onKeyDown: (event) => {
|
|
2737
|
+
if (event.key === "Escape" && !event.defaultPrevented) {
|
|
2738
|
+
event.preventDefault();
|
|
2739
|
+
close();
|
|
2740
|
+
}
|
|
2741
|
+
if (mobile || !docked) trapTab(event, column.current);
|
|
2742
|
+
},
|
|
2743
|
+
children: [
|
|
2744
|
+
mobile && /* @__PURE__ */ jsx("div", { className: "cbx-sheet-handle cbx-sheet-grab", "aria-hidden": "true" }),
|
|
2745
|
+
/* @__PURE__ */ jsxs("div", { className: mobile ? `cbx-sheet-head cbx-sheet-grab ${view !== "home" ? "has-back" : ""}` : "cbx-help-head", children: [
|
|
2746
|
+
view !== "home" ? /* @__PURE__ */ jsx("button", { type: "button", className: mobile ? "cbx-sheet-back" : "cbx-icon-button", onClick: back, "aria-label": t("Back to Help"), children: mobile ? /* @__PURE__ */ jsx(ChevronLeft, { size: 20, strokeWidth: 1.8, "aria-hidden": true }) : /* @__PURE__ */ jsx(ArrowLeft, { size: 18, strokeWidth: 1.8, "aria-hidden": true }) }) : !mobile && /* @__PURE__ */ jsx(LifeBuoy, { className: "cbx-help-mark", size: 18, strokeWidth: 1.8, "aria-hidden": true }),
|
|
2747
|
+
/* @__PURE__ */ jsx("h2", { className: mobile ? "cbx-sheet-title cbx-truncate" : "cbx-help-title", children: view === "article" ? t("Article") : view === "chat" ? t("Ask Cbox") : mobile ? t("Help with {page}", { page: topic }) : t("Help") }),
|
|
2748
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "cbx-icon-button", onClick: close, "aria-label": t("Close Help"), children: /* @__PURE__ */ jsx(X, { size: 18, strokeWidth: 1.8, "aria-hidden": true }) })
|
|
2749
|
+
] }),
|
|
2750
|
+
view === "chat" && context(true),
|
|
2751
|
+
/* @__PURE__ */ jsx("div", { ref: body, className: `${mobile ? "cbx-sheet-body" : "cbx-help-body"} ${view === "chat" ? "is-chat" : ""}`, "data-cbx-sheet-scroll": mobile ? "" : void 0, onScroll: (event) => onScroll(event.currentTarget.scrollTop), children: content }),
|
|
2752
|
+
foot
|
|
2753
|
+
]
|
|
2764
2754
|
}
|
|
2765
|
-
|
|
2766
|
-
},
|
|
2767
|
-
children: [
|
|
2768
|
-
/* @__PURE__ */ jsxs("div", { className: "cbx-help-head", children: [
|
|
2769
|
-
view !== "home" ? /* @__PURE__ */ jsx("button", { type: "button", className: "cbx-icon-button", onClick: back, "aria-label": t("Back to Help"), children: /* @__PURE__ */ jsx(ArrowLeft, { size: 18, strokeWidth: 1.8, "aria-hidden": true }) }) : /* @__PURE__ */ jsx(LifeBuoy, { className: "cbx-help-mark", size: 18, strokeWidth: 1.8, "aria-hidden": true }),
|
|
2770
|
-
/* @__PURE__ */ jsx("h2", { className: "cbx-help-title", children: view === "article" ? t("Article") : view === "chat" ? t("Ask Cbox") : t("Help") }),
|
|
2771
|
-
/* @__PURE__ */ jsx("button", { type: "button", className: "cbx-icon-button", onClick: close, "aria-label": t("Close Help"), children: /* @__PURE__ */ jsx(X, { size: 18, strokeWidth: 1.8, "aria-hidden": true }) })
|
|
2772
|
-
] }),
|
|
2773
|
-
view === "chat" && context(true),
|
|
2774
|
-
/* @__PURE__ */ jsx("div", { ref: body, className: `cbx-help-body ${view === "chat" ? "is-chat" : ""}`, onScroll: (event) => onScroll(event.currentTarget.scrollTop), children: content }),
|
|
2775
|
-
foot
|
|
2776
|
-
]
|
|
2755
|
+
)
|
|
2777
2756
|
}
|
|
2778
2757
|
);
|
|
2779
2758
|
}
|
|
@@ -4920,8 +4899,52 @@ function CboxAppCatalog({ endpoint, currentAppKey, theme, className }) {
|
|
|
4920
4899
|
className
|
|
4921
4900
|
});
|
|
4922
4901
|
}
|
|
4902
|
+
var FieldContext = createContext(null);
|
|
4903
|
+
function useFieldControl() {
|
|
4904
|
+
const field = useContext(FieldContext);
|
|
4905
|
+
if (field === null) return {};
|
|
4906
|
+
return {
|
|
4907
|
+
id: field.controlId,
|
|
4908
|
+
...field.describedBy !== void 0 ? { "aria-describedby": field.describedBy } : {},
|
|
4909
|
+
...field.invalid ? { "aria-invalid": true } : {},
|
|
4910
|
+
...field.required ? { required: true } : {}
|
|
4911
|
+
};
|
|
4912
|
+
}
|
|
4913
|
+
function Field({ label, id: statedId, labelAction, hint, error, required = false, optional = false, className, children }) {
|
|
4914
|
+
const { t } = useCboxLocalization();
|
|
4915
|
+
const generated = useId();
|
|
4916
|
+
const base = statedId ?? generated;
|
|
4917
|
+
const controlId = statedId ?? `${generated}-control`;
|
|
4918
|
+
const hintId = `${base}-hint`;
|
|
4919
|
+
const errorId = `${base}-error`;
|
|
4920
|
+
const hasError = error !== void 0 && error !== null && error !== "";
|
|
4921
|
+
const describedBy = [hint !== void 0 ? hintId : null, hasError ? errorId : null].filter(Boolean).join(" ") || void 0;
|
|
4922
|
+
const context = useMemo(() => ({ controlId, describedBy, invalid: hasError, required }), [controlId, describedBy, hasError, required]);
|
|
4923
|
+
const labelElement = /* @__PURE__ */ jsxs("label", { className: "cbx-ui-label", htmlFor: controlId, children: [
|
|
4924
|
+
label,
|
|
4925
|
+
required && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4926
|
+
" ",
|
|
4927
|
+
/* @__PURE__ */ jsx("span", { className: "cbx-ui-label-required", "aria-hidden": "true", children: "*" }),
|
|
4928
|
+
/* @__PURE__ */ jsx("span", { className: "cbx-ui-sr-only", children: t("(required)") })
|
|
4929
|
+
] }),
|
|
4930
|
+
optional && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4931
|
+
" ",
|
|
4932
|
+
/* @__PURE__ */ jsx("span", { className: "cbx-ui-label-optional", children: t("(optional)") })
|
|
4933
|
+
] })
|
|
4934
|
+
] });
|
|
4935
|
+
return /* @__PURE__ */ jsx(FieldContext.Provider, { value: context, children: /* @__PURE__ */ jsxs("div", { className: cn("cbx-ui-field", className), children: [
|
|
4936
|
+
labelAction !== void 0 ? /* @__PURE__ */ jsxs("div", { className: "cbx-ui-field-head", children: [
|
|
4937
|
+
labelElement,
|
|
4938
|
+
labelAction
|
|
4939
|
+
] }) : labelElement,
|
|
4940
|
+
children,
|
|
4941
|
+
hint !== void 0 && /* @__PURE__ */ jsx("p", { id: hintId, className: "cbx-ui-hint", children: hint }),
|
|
4942
|
+
/* @__PURE__ */ jsx("p", { id: errorId, className: "cbx-ui-error", role: "alert", hidden: !hasError, children: hasError ? error : null })
|
|
4943
|
+
] }) });
|
|
4944
|
+
}
|
|
4923
4945
|
function Combobox(props) {
|
|
4924
4946
|
const { t } = useCboxLocalization();
|
|
4947
|
+
const field = useFieldControl();
|
|
4925
4948
|
const {
|
|
4926
4949
|
items,
|
|
4927
4950
|
placeholder = t("Select\u2026"),
|
|
@@ -4929,7 +4952,7 @@ function Combobox(props) {
|
|
|
4929
4952
|
emptyText = t("Nothing matches."),
|
|
4930
4953
|
footerLink,
|
|
4931
4954
|
disabled = false,
|
|
4932
|
-
required = false,
|
|
4955
|
+
required = field.required ?? false,
|
|
4933
4956
|
ariaLabel,
|
|
4934
4957
|
triggerClassName,
|
|
4935
4958
|
panelClassName,
|
|
@@ -4952,10 +4975,11 @@ function Combobox(props) {
|
|
|
4952
4975
|
const [query2, setQuery] = useState("");
|
|
4953
4976
|
const [highlightIndex, setHighlightIndex] = useState(-1);
|
|
4954
4977
|
const containerRef = useRef(null);
|
|
4978
|
+
const triggerRef = useRef(null);
|
|
4955
4979
|
const inputRef = useRef(null);
|
|
4956
4980
|
const listRef = useRef(null);
|
|
4957
4981
|
const reactId = useId();
|
|
4958
|
-
const id = idProp ?? reactId;
|
|
4982
|
+
const id = idProp ?? field.id ?? reactId;
|
|
4959
4983
|
const listId = `${id}-listbox`;
|
|
4960
4984
|
const filteredGroups = useMemo(
|
|
4961
4985
|
() => filterGroups(groups, query2),
|
|
@@ -4998,6 +5022,7 @@ function Combobox(props) {
|
|
|
4998
5022
|
return;
|
|
4999
5023
|
}
|
|
5000
5024
|
if (props.onChange !== void 0) {
|
|
5025
|
+
triggerRef.current?.focus();
|
|
5001
5026
|
props.onChange(opt.value);
|
|
5002
5027
|
}
|
|
5003
5028
|
setOpen(false);
|
|
@@ -5049,11 +5074,6 @@ function Combobox(props) {
|
|
|
5049
5074
|
}
|
|
5050
5075
|
return;
|
|
5051
5076
|
}
|
|
5052
|
-
if (event.key === "Escape") {
|
|
5053
|
-
event.preventDefault();
|
|
5054
|
-
setOpen(false);
|
|
5055
|
-
return;
|
|
5056
|
-
}
|
|
5057
5077
|
if (event.key === "Tab") {
|
|
5058
5078
|
setOpen(false);
|
|
5059
5079
|
return;
|
|
@@ -5066,10 +5086,19 @@ function Combobox(props) {
|
|
|
5066
5086
|
{
|
|
5067
5087
|
ref: containerRef,
|
|
5068
5088
|
className: cn("relative", triggerWidth === "full" && "w-full", className),
|
|
5089
|
+
onKeyDown: (event) => {
|
|
5090
|
+
if (open && event.key === "Escape") {
|
|
5091
|
+
event.preventDefault();
|
|
5092
|
+
event.stopPropagation();
|
|
5093
|
+
setOpen(false);
|
|
5094
|
+
triggerRef.current?.focus();
|
|
5095
|
+
}
|
|
5096
|
+
},
|
|
5069
5097
|
children: [
|
|
5070
5098
|
/* @__PURE__ */ jsxs(
|
|
5071
5099
|
"button",
|
|
5072
5100
|
{
|
|
5101
|
+
ref: triggerRef,
|
|
5073
5102
|
id,
|
|
5074
5103
|
type: "button",
|
|
5075
5104
|
role: "combobox",
|
|
@@ -5079,6 +5108,8 @@ function Combobox(props) {
|
|
|
5079
5108
|
"aria-controls": listId,
|
|
5080
5109
|
"aria-required": required,
|
|
5081
5110
|
"aria-label": ariaLabel,
|
|
5111
|
+
"aria-describedby": props["aria-describedby"] ?? field["aria-describedby"],
|
|
5112
|
+
"aria-invalid": props["aria-invalid"] ?? field["aria-invalid"],
|
|
5082
5113
|
onClick: () => setOpen((v) => !v),
|
|
5083
5114
|
className: cn(
|
|
5084
5115
|
"flex h-9 items-center gap-2 rounded-md border border-input bg-card px-3 text-left text-[13px] text-foreground transition-colors",
|
|
@@ -5827,49 +5858,6 @@ function Checkbox({ checked, onCheckedChange, label, hint, disabled = false, req
|
|
|
5827
5858
|
] })
|
|
5828
5859
|
] });
|
|
5829
5860
|
}
|
|
5830
|
-
var FieldContext = createContext(null);
|
|
5831
|
-
function useFieldControl() {
|
|
5832
|
-
const field = useContext(FieldContext);
|
|
5833
|
-
if (field === null) return {};
|
|
5834
|
-
return {
|
|
5835
|
-
id: field.controlId,
|
|
5836
|
-
...field.describedBy !== void 0 ? { "aria-describedby": field.describedBy } : {},
|
|
5837
|
-
...field.invalid ? { "aria-invalid": true } : {},
|
|
5838
|
-
...field.required ? { required: true } : {}
|
|
5839
|
-
};
|
|
5840
|
-
}
|
|
5841
|
-
function Field({ label, id: statedId, labelAction, hint, error, required = false, optional = false, className, children }) {
|
|
5842
|
-
const { t } = useCboxLocalization();
|
|
5843
|
-
const generated = useId();
|
|
5844
|
-
const base = statedId ?? generated;
|
|
5845
|
-
const controlId = statedId ?? `${generated}-control`;
|
|
5846
|
-
const hintId = `${base}-hint`;
|
|
5847
|
-
const errorId = `${base}-error`;
|
|
5848
|
-
const hasError = error !== void 0 && error !== null && error !== "";
|
|
5849
|
-
const describedBy = [hint !== void 0 ? hintId : null, hasError ? errorId : null].filter(Boolean).join(" ") || void 0;
|
|
5850
|
-
const context = useMemo(() => ({ controlId, describedBy, invalid: hasError, required }), [controlId, describedBy, hasError, required]);
|
|
5851
|
-
const labelElement = /* @__PURE__ */ jsxs("label", { className: "cbx-ui-label", htmlFor: controlId, children: [
|
|
5852
|
-
label,
|
|
5853
|
-
required && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5854
|
-
" ",
|
|
5855
|
-
/* @__PURE__ */ jsx("span", { className: "cbx-ui-label-required", "aria-hidden": "true", children: "*" }),
|
|
5856
|
-
/* @__PURE__ */ jsx("span", { className: "cbx-ui-sr-only", children: t("(required)") })
|
|
5857
|
-
] }),
|
|
5858
|
-
optional && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5859
|
-
" ",
|
|
5860
|
-
/* @__PURE__ */ jsx("span", { className: "cbx-ui-label-optional", children: t("(optional)") })
|
|
5861
|
-
] })
|
|
5862
|
-
] });
|
|
5863
|
-
return /* @__PURE__ */ jsx(FieldContext.Provider, { value: context, children: /* @__PURE__ */ jsxs("div", { className: cn("cbx-ui-field", className), children: [
|
|
5864
|
-
labelAction !== void 0 ? /* @__PURE__ */ jsxs("div", { className: "cbx-ui-field-head", children: [
|
|
5865
|
-
labelElement,
|
|
5866
|
-
labelAction
|
|
5867
|
-
] }) : labelElement,
|
|
5868
|
-
children,
|
|
5869
|
-
hint !== void 0 && /* @__PURE__ */ jsx("p", { id: hintId, className: "cbx-ui-hint", children: hint }),
|
|
5870
|
-
/* @__PURE__ */ jsx("p", { id: errorId, className: "cbx-ui-error", role: "alert", hidden: !hasError, children: hasError ? error : null })
|
|
5871
|
-
] }) });
|
|
5872
|
-
}
|
|
5873
5861
|
var Input = forwardRef(function Input2({ scale = "md", className, ...props }, ref) {
|
|
5874
5862
|
const field = useFieldControl();
|
|
5875
5863
|
return /* @__PURE__ */ jsx("input", { ref, className: cn("cbx-ui-input", scale === "lg" && "cbx-ui-input--lg", className), ...field, ...props });
|