@harborclient/sdk 1.0.12 → 1.0.14
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/FormGroup/index.d.ts +3 -2
- package/dist/components/FormGroup/index.d.ts.map +1 -1
- package/dist/components/FormGroup/index.js +27 -15
- package/dist/components/PageHeader/index.d.ts.map +1 -1
- package/dist/components/PageHeader/index.js +3 -3
- package/dist/components/VariableInput/index.js +3 -3
- package/dist/components/VariableTable/index.js +1 -1
- package/package.json +1 -1
|
@@ -21,7 +21,8 @@ interface Props {
|
|
|
21
21
|
*/
|
|
22
22
|
htmlFor?: string;
|
|
23
23
|
/**
|
|
24
|
-
* Muted helper text rendered below the control (stacked layout
|
|
24
|
+
* Muted helper text rendered below the label and above the control (stacked layout),
|
|
25
|
+
* or below the checkbox row inside the bordered box (checkbox layout).
|
|
25
26
|
*/
|
|
26
27
|
description?: ReactNode;
|
|
27
28
|
/**
|
|
@@ -65,7 +66,7 @@ interface Props {
|
|
|
65
66
|
* @param label - Field label text.
|
|
66
67
|
* @param children - Input, select, or composite control content.
|
|
67
68
|
* @param htmlFor - ID of the primary associated control.
|
|
68
|
-
* @param description - Optional helper text below the control.
|
|
69
|
+
* @param description - Optional helper text below the label and above the control.
|
|
69
70
|
* @param error - Optional validation error below the control.
|
|
70
71
|
* @param errorId - Explicit error element id for `aria-describedby`.
|
|
71
72
|
* @param descriptionId - Explicit description element id for `aria-describedby`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FormGroup/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAI5C;;GAEG;AACH,MAAM,MAAM,eAAe,GACvB,SAAS,GACT,UAAU,GACV,QAAQ,GACR,OAAO,GACP,kBAAkB,GAClB,YAAY,CAAC;AAEjB;;GAEG;AACH,MAAM,MAAM,kBA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AAO,EACP,WAAW,EACX,KAAK,EACL,OAAO,EACP,aAAa,EACb,MAAkB,EAClB,SAAqB,EACrB,MAAc,EACd,SAAS,EACT,cAAc,EACf,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CAiJrB"}
|
|
@@ -11,7 +11,7 @@ import { enhanceControl } from '../enhanceControl.js';
|
|
|
11
11
|
* @returns Class string for the label element.
|
|
12
12
|
*/
|
|
13
13
|
function labelClasses(tone, srOnly, inline) {
|
|
14
|
-
const base = 'text-[
|
|
14
|
+
const base = 'text-[18px]';
|
|
15
15
|
const visibility = srOnly ? 'sr-only' : '';
|
|
16
16
|
if (inline) {
|
|
17
17
|
const color = tone === 'muted' ? 'shrink-0 text-muted' : 'shrink-0 font-medium text-text';
|
|
@@ -28,7 +28,7 @@ function labelClasses(tone, srOnly, inline) {
|
|
|
28
28
|
* @param label - Field label text.
|
|
29
29
|
* @param children - Input, select, or composite control content.
|
|
30
30
|
* @param htmlFor - ID of the primary associated control.
|
|
31
|
-
* @param description - Optional helper text below the control.
|
|
31
|
+
* @param description - Optional helper text below the label and above the control.
|
|
32
32
|
* @param error - Optional validation error below the control.
|
|
33
33
|
* @param errorId - Explicit error element id for `aria-describedby`.
|
|
34
34
|
* @param descriptionId - Explicit description element id for `aria-describedby`.
|
|
@@ -45,35 +45,47 @@ export function FormGroup({ label, children, htmlFor, description, error, errorI
|
|
|
45
45
|
if (layout === 'associated') {
|
|
46
46
|
const associatedClasses = labelClassName
|
|
47
47
|
? `hc-form-group ${labelClassName}`
|
|
48
|
-
: 'hc-form-group text-[
|
|
48
|
+
: 'hc-form-group text-[16px] text-text';
|
|
49
49
|
return (_jsx("label", { htmlFor: htmlFor, className: associatedClasses, children: label }));
|
|
50
50
|
}
|
|
51
51
|
if (layout === 'checkboxAdjacent') {
|
|
52
52
|
const wrapperClasses = extra
|
|
53
53
|
? `hc-form-group flex items-start gap-2 ${extra}`
|
|
54
54
|
: 'hc-form-group flex items-start gap-2';
|
|
55
|
-
const adjacentLabelClasses = labelClassName ?? 'min-w-0 flex-1 text-[
|
|
55
|
+
const adjacentLabelClasses = labelClassName ?? 'min-w-0 flex-1 text-[16px] text-text';
|
|
56
56
|
const linkedChildren = enhanceControl(children, { id: controlId });
|
|
57
57
|
return (_jsxs("div", { className: wrapperClasses, children: [linkedChildren, _jsx("label", { htmlFor: controlId, className: adjacentLabelClasses, children: label })] }));
|
|
58
58
|
}
|
|
59
59
|
if (layout === 'radio') {
|
|
60
60
|
const wrapperClasses = extra
|
|
61
|
-
? `hc-form-group inline-flex cursor-pointer items-center gap-1.5 text-[
|
|
62
|
-
: 'hc-form-group inline-flex cursor-pointer items-center gap-1.5 text-[
|
|
61
|
+
? `hc-form-group inline-flex cursor-pointer items-center gap-1.5 text-[16px] text-text app-no-drag ${extra}`
|
|
62
|
+
: 'hc-form-group inline-flex cursor-pointer items-center gap-1.5 text-[16px] text-text app-no-drag';
|
|
63
63
|
const linkedChildren = enhanceControl(children, { id: controlId });
|
|
64
64
|
return (_jsxs("label", { htmlFor: controlId, className: wrapperClasses, children: [linkedChildren, label] }));
|
|
65
65
|
}
|
|
66
66
|
if (layout === 'checkbox') {
|
|
67
|
+
const resolvedDescriptionId = description != null && description !== ''
|
|
68
|
+
? (descriptionId ?? (htmlFor ? `${htmlFor}-description` : undefined))
|
|
69
|
+
: undefined;
|
|
70
|
+
const resolvedErrorId = error != null && error !== ''
|
|
71
|
+
? (errorId ?? (htmlFor ? `${htmlFor}-error` : undefined))
|
|
72
|
+
: undefined;
|
|
73
|
+
const describedByIds = [resolvedDescriptionId, resolvedErrorId].filter((id) => id != null);
|
|
74
|
+
const describedBy = describedByIds.length > 0 ? describedByIds.join(' ') : undefined;
|
|
75
|
+
const linkedChildren = enhanceControl(children, {
|
|
76
|
+
describedBy,
|
|
77
|
+
id: controlId,
|
|
78
|
+
invalid: resolvedErrorId != null
|
|
79
|
+
});
|
|
67
80
|
const wrapperClasses = extra
|
|
68
|
-
? `hc-form-group flex
|
|
69
|
-
: 'hc-form-group flex
|
|
70
|
-
|
|
71
|
-
return (_jsxs("label", { htmlFor: controlId, className: wrapperClasses, children: [linkedChildren, _jsx("span", { className: labelClasses(labelTone, srOnly, false), children: label })] }));
|
|
81
|
+
? `hc-form-group flex flex-col gap-1 p-4 border border-separator rounded-md ${extra}`
|
|
82
|
+
: 'hc-form-group flex flex-col gap-1 p-4 border border-separator rounded-md';
|
|
83
|
+
return (_jsxs("div", { className: wrapperClasses, children: [_jsxs("label", { htmlFor: controlId, className: "flex flex-col gap-1", children: [_jsxs("span", { className: "flex items-center gap-2", children: [linkedChildren, _jsx("span", { className: `${labelClasses(labelTone, srOnly, false)} leading-none`, children: label })] }), resolvedDescriptionId ? (_jsx("p", { id: resolvedDescriptionId, className: "hc-form-description m-0 pl-[26px] text-[14px] text-muted", children: description })) : null] }), resolvedErrorId ? (_jsx(FieldError, { id: resolvedErrorId, spacing: "field", children: error })) : null] }));
|
|
72
84
|
}
|
|
73
85
|
if (layout === 'inline') {
|
|
74
86
|
const wrapperClasses = extra
|
|
75
|
-
? `hc-form-group flex min-w-0 flex-1 items-center gap-2 ${extra}`
|
|
76
|
-
: 'hc-form-group flex min-w-0 flex-1 items-center gap-2';
|
|
87
|
+
? `hc-form-group flex min-w-0 flex-1 items-center gap-2 p-4 border border-separator rounded-md ${extra}`
|
|
88
|
+
: 'hc-form-group flex min-w-0 flex-1 items-center gap-2 p-4 border border-separator rounded-md';
|
|
77
89
|
const linkedChildren = enhanceControl(children, { id: controlId });
|
|
78
90
|
return (_jsxs("label", { htmlFor: controlId, className: wrapperClasses, children: [_jsx("span", { className: labelClasses(labelTone, srOnly, true), children: label }), linkedChildren] }));
|
|
79
91
|
}
|
|
@@ -91,7 +103,7 @@ export function FormGroup({ label, children, htmlFor, description, error, errorI
|
|
|
91
103
|
id: htmlFor
|
|
92
104
|
});
|
|
93
105
|
const wrapperClasses = extra
|
|
94
|
-
? `hc-form-group flex flex-col gap-1 ${extra}`
|
|
95
|
-
: 'hc-form-group flex flex-col gap-1';
|
|
96
|
-
return (_jsxs("div", { className: wrapperClasses, children: [_jsxs("label", { htmlFor: htmlFor, className: "flex flex-col gap-1", children: [_jsx("span", { className: labelClasses(labelTone, srOnly, false), children: label }),
|
|
106
|
+
? `hc-form-group flex flex-col gap-1 p-4 text-[16px] border border-separator rounded-md ${extra}`
|
|
107
|
+
: 'hc-form-group flex flex-col gap-1 p-4 text-[16px] border border-separator rounded-md';
|
|
108
|
+
return (_jsxs("div", { className: wrapperClasses, children: [_jsxs("label", { htmlFor: htmlFor, className: "flex flex-col gap-1", children: [_jsx("span", { className: labelClasses(labelTone, srOnly, false), children: label }), resolvedDescriptionId ? (_jsx("p", { id: resolvedDescriptionId, className: "hc-form-description m-0 text-[14px] text-muted", children: description })) : null, control] }), resolvedErrorId ? (_jsx(FieldError, { id: resolvedErrorId, spacing: "field", children: error })) : null] }));
|
|
97
109
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PageHeader/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG5C,UAAU,KAAK;IACb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PageHeader/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAG5C,UAAU,KAAK;IACb;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,KAAK,GAAG,GAAG,CAAC,OAAO,CAmBhG"}
|
|
@@ -6,7 +6,7 @@ import { FaIcon } from '../FaIcon/index.js';
|
|
|
6
6
|
*/
|
|
7
7
|
export function PageHeader({ title, description, icon, children, className }) {
|
|
8
8
|
const wrapperClassName = className
|
|
9
|
-
? `hc-page-header -mx-6 mb-4 flex flex-wrap items-center gap-2 border-b border-separator px-6 py-
|
|
10
|
-
: 'hc-page-header -mx-6 mb-4 flex flex-wrap items-center gap-2 border-b border-separator px-6 py-
|
|
11
|
-
return (_jsxs("div", { className: wrapperClassName, children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("h2", { className: "m-0 flex items-center gap-2 text-[18px] font-semibold text-text leading-none", children: [icon ? _jsx(FaIcon, { icon: icon, className: "h-5 w-5 shrink-0 text-muted", "aria-hidden": true }) : null, title] }), description ? _jsx("p", { className: "m-0 mt-1 text-[
|
|
9
|
+
? `hc-page-header -mx-6 mb-4 flex flex-wrap items-center gap-2 border-b border-separator px-6 py-4 ${className}`
|
|
10
|
+
: 'hc-page-header -mx-6 mb-4 flex flex-wrap items-center gap-2 border-b border-separator px-6 py-4';
|
|
11
|
+
return (_jsxs("div", { className: wrapperClassName, children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("h2", { className: "m-0 flex items-center gap-2 text-[18px] font-semibold text-text leading-none mb-2", children: [icon ? _jsx(FaIcon, { icon: icon, className: "h-5 w-5 shrink-0 text-muted", "aria-hidden": true }) : null, title] }), description ? (_jsx("p", { className: "m-0 mt-1 text-[16px] text-muted leading-none", children: description })) : null] }), children ? _jsx("div", { className: "flex flex-wrap items-center gap-2", children: children }) : null] }));
|
|
12
12
|
}
|
|
@@ -42,7 +42,7 @@ export function VariableInput({ value, onChange, variables, placeholder, onKeyDo
|
|
|
42
42
|
*/
|
|
43
43
|
const scheduleHide = () => {
|
|
44
44
|
cancelHide();
|
|
45
|
-
hideTimer.current = window.setTimeout(() => setTooltip(null),
|
|
45
|
+
hideTimer.current = window.setTimeout(() => setTooltip(null), 400);
|
|
46
46
|
};
|
|
47
47
|
/**
|
|
48
48
|
* Clears any pending tooltip hide timer when the component unmounts.
|
|
@@ -127,7 +127,7 @@ export function VariableInput({ value, onChange, variables, placeholder, onKeyDo
|
|
|
127
127
|
return;
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
scheduleHide();
|
|
131
131
|
};
|
|
132
132
|
/**
|
|
133
133
|
* Handles keyboard events on the input, including tooltip dismissal.
|
|
@@ -176,7 +176,7 @@ export function VariableInput({ value, onChange, variables, placeholder, onKeyDo
|
|
|
176
176
|
}, onFocus: () => {
|
|
177
177
|
openAutocomplete();
|
|
178
178
|
updateTooltipFromCaret();
|
|
179
|
-
}, onBlur: closeAutocomplete, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, onSelect: updateTooltipFromCaret, onClick: updateTooltipFromCaret, onScroll: syncScroll, onMouseMove: handleMouseMove, onMouseLeave: scheduleHide }), source && (_jsx(SuggestionList, { open: autocompleteOpen, items: autocompleteItems, activeIndex: autocompleteActiveIndex, anchorRef: inputRef, listboxId: listboxId, onSelect: selectItem, onActiveIndexChange: setActiveIndex, onClose: closeSuggestions })), tooltip && tooltipContent && (_jsxs("div", { id: tooltipId, role: "tooltip", className: "pointer-events-auto fixed z-50 flex max-w-sm -translate-x-1/2 -translate-y-full flex-col gap-
|
|
179
|
+
}, onBlur: closeAutocomplete, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, onSelect: updateTooltipFromCaret, onClick: updateTooltipFromCaret, onScroll: syncScroll, onMouseMove: handleMouseMove, onMouseLeave: scheduleHide }), source && (_jsx(SuggestionList, { open: autocompleteOpen, items: autocompleteItems, activeIndex: autocompleteActiveIndex, anchorRef: inputRef, listboxId: listboxId, onSelect: selectItem, onActiveIndexChange: setActiveIndex, onClose: closeSuggestions })), tooltip && tooltipContent && (_jsxs("div", { id: tooltipId, role: "tooltip", className: "pointer-events-auto fixed z-50 flex max-w-sm -translate-x-1/2 -translate-y-full flex-col gap-2 rounded-md border border-separator bg-surface px-4 py-3 text-[14px] text-text shadow-md after:pointer-events-auto after:absolute after:-bottom-2 after:left-0 after:right-0 after:h-2 after:content-['']", style: { top: tooltip.top - 4, left: tooltip.left }, onMouseEnter: cancelHide, onMouseLeave: scheduleHide, children: [_jsx("span", { className: tooltipContent.muted ? 'text-muted' : undefined, children: tooltipContent.text }), onEditVariable && (_jsx("button", { type: "button", className: "-mx-1 self-start rounded px-1 py-0.5 text-[14px] text-accent hover:underline app-no-drag", "aria-label": `Edit value for ${tooltip.key}`, onClick: () => {
|
|
180
180
|
onEditVariable();
|
|
181
181
|
setTooltip(null);
|
|
182
182
|
}, children: "Edit value" }))] }))] }));
|
|
@@ -39,5 +39,5 @@ export function VariableTable({ variables, onChange, description }) {
|
|
|
39
39
|
}
|
|
40
40
|
onChange(variables.filter((_, i) => i !== index));
|
|
41
41
|
};
|
|
42
|
-
return (_jsxs("div", { className: "hc-variable-table", children: [description && _jsx("p", { className: "mb-3 text-[14px] text-muted", children: description }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsxs(Table, {
|
|
42
|
+
return (_jsxs("div", { className: "hc-variable-table", children: [description && _jsx("p", { className: "mb-3 text-[14px] text-muted", children: description }), _jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs("tr", { children: [_jsx(TableHead, { children: "Key" }), _jsx(TableHead, { children: "Value" }), _jsx(TableHead, { children: "Default" }), _jsx(TableHead, { className: "w-14 text-center", children: "Share" }), _jsx(TableHead, { className: "w-7 p-0 text-center" })] }) }), _jsx(TableBody, { children: variables.map((variable, index) => (_jsxs("tr", { children: [_jsx(TableCell, { children: _jsx(Input, { type: "text", className: "w-full", value: variable.key, placeholder: "variable", "aria-label": `Key, row ${index + 1}`, onChange: (e) => updateVariable(index, { key: e.target.value }) }) }), _jsx(TableCell, { children: _jsx(Input, { type: "text", className: "w-full", value: variable.value, placeholder: "value", "aria-label": `Value, row ${index + 1}`, onChange: (e) => updateVariable(index, { value: e.target.value }) }) }), _jsx(TableCell, { children: _jsx(Input, { type: "text", className: "w-full", value: variable.defaultValue, placeholder: "default", "aria-label": `Default, row ${index + 1}`, onChange: (e) => updateVariable(index, { defaultValue: e.target.value }) }) }), _jsx(TableCell, { className: "w-14 text-center", children: _jsx(Checkbox, { checked: variable.share, onChange: (e) => updateVariable(index, { share: e.target.checked }), "aria-label": `Include value in export, row ${index + 1}`, title: "Include value in export" }) }), _jsx(TableCell, { className: "w-7 p-0 text-center", children: _jsx(Button, { type: "button", variant: "iconDanger", onClick: () => removeVariable(index), title: "Remove", "aria-label": `Remove row ${index + 1}`, children: _jsx(FaIcon, { icon: faXmark, className: "h-3.5 w-3.5" }) }) })] }, index))) })] }), _jsxs(Button, { type: "button", variant: "toolbar", className: "inline-flex items-center gap-1 self-start", onClick: addVariable, children: [_jsx(FaIcon, { icon: faPlus, className: "h-3 w-3" }), "Add variable"] })] })] }));
|
|
43
43
|
}
|