@flytedan/flytebot-design-system 0.37.0 → 0.38.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/index.cjs +36 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -3
- package/dist/index.d.ts +20 -3
- package/dist/index.js +36 -36
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- package/styles/components.css +53 -0
package/dist/index.cjs
CHANGED
|
@@ -248,6 +248,9 @@ var VARIANTS = {
|
|
|
248
248
|
danger: "fd-btn-danger",
|
|
249
249
|
link: "fd-btn-link"
|
|
250
250
|
};
|
|
251
|
+
function isActivationKey(key) {
|
|
252
|
+
return key === "Enter" || key === " ";
|
|
253
|
+
}
|
|
251
254
|
function Button({
|
|
252
255
|
children,
|
|
253
256
|
variant = "primary",
|
|
@@ -257,12 +260,16 @@ function Button({
|
|
|
257
260
|
arrow = false,
|
|
258
261
|
loading = false,
|
|
259
262
|
disabled = false,
|
|
263
|
+
focusableWhenDisabled = false,
|
|
260
264
|
block = false,
|
|
261
265
|
as = "button",
|
|
262
266
|
className = "",
|
|
267
|
+
onClick,
|
|
268
|
+
onKeyDown,
|
|
263
269
|
...rest
|
|
264
270
|
}) {
|
|
265
271
|
const Tag2 = as;
|
|
272
|
+
const inert = (disabled || loading) && focusableWhenDisabled;
|
|
266
273
|
const cls = [
|
|
267
274
|
"fd-btn",
|
|
268
275
|
VARIANTS[variant] || VARIANTS.primary,
|
|
@@ -275,9 +282,16 @@ function Button({
|
|
|
275
282
|
Tag2,
|
|
276
283
|
{
|
|
277
284
|
className: cls,
|
|
278
|
-
disabled: Tag2 === "button" ? disabled || loading : void 0,
|
|
279
|
-
"aria-disabled": disabled || loading ? "true" : void 0,
|
|
285
|
+
disabled: Tag2 === "button" ? (disabled || loading) && !focusableWhenDisabled : void 0,
|
|
286
|
+
"aria-disabled": focusableWhenDisabled ? String(disabled || loading) : disabled || loading ? "true" : void 0,
|
|
280
287
|
"aria-busy": loading ? "true" : void 0,
|
|
288
|
+
onClick: inert ? (e) => {
|
|
289
|
+
e.preventDefault();
|
|
290
|
+
} : onClick,
|
|
291
|
+
onKeyDown: inert ? (e) => {
|
|
292
|
+
if (isActivationKey(e.key)) e.preventDefault();
|
|
293
|
+
onKeyDown?.(e);
|
|
294
|
+
} : onKeyDown,
|
|
281
295
|
...rest,
|
|
282
296
|
children: [
|
|
283
297
|
icon && !loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { className: "ph ph-" + icon, "aria-hidden": "true" }) : null,
|
|
@@ -3436,12 +3450,23 @@ function DatePicker({ label, help, error, required = false, disabled = false, ra
|
|
|
3436
3450
|
|
|
3437
3451
|
// src/components/forms/Textarea.tsx
|
|
3438
3452
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3439
|
-
function Textarea({ label, help, error, required = false, rows = 4, disabled = false, id, className = "", style, ...rest }) {
|
|
3453
|
+
function Textarea({ label, help, error, required = false, rows = 4, disabled = false, busy = false, readOnly, id, className = "", style, ...rest }) {
|
|
3440
3454
|
const fieldId = useFieldId(id);
|
|
3441
|
-
const box = ["fd-input", "fd-input-textarea", error ? "fd-input-error" : "", disabled ? "fd-input-disabled" : ""].filter(Boolean).join(" ");
|
|
3455
|
+
const box = ["fd-input", "fd-input-textarea", error ? "fd-input-error" : "", disabled || busy ? "fd-input-disabled" : ""].filter(Boolean).join(" ");
|
|
3442
3456
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: ["fd-field", className].filter(Boolean).join(" "), style, children: [
|
|
3443
3457
|
label ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(FieldLabel, { htmlFor: fieldId, required, children: label }) : null,
|
|
3444
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: box, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3458
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: box, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
3459
|
+
"textarea",
|
|
3460
|
+
{
|
|
3461
|
+
id: fieldId,
|
|
3462
|
+
rows,
|
|
3463
|
+
disabled,
|
|
3464
|
+
readOnly: busy || readOnly,
|
|
3465
|
+
"aria-busy": busy || void 0,
|
|
3466
|
+
"aria-invalid": error ? "true" : void 0,
|
|
3467
|
+
...rest
|
|
3468
|
+
}
|
|
3469
|
+
) }),
|
|
3445
3470
|
error ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "fd-field-error", children: [
|
|
3446
3471
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("i", { className: "ph ph-warning-circle", "aria-hidden": "true" }),
|
|
3447
3472
|
error
|
|
@@ -3816,8 +3841,7 @@ function MultiSelectPanel({
|
|
|
3816
3841
|
rows: 4,
|
|
3817
3842
|
placeholder: field.pastePlaceholder || field.placeholder || "Paste names, one per line or comma-separated",
|
|
3818
3843
|
value: pasteText,
|
|
3819
|
-
|
|
3820
|
-
"aria-busy": pasteLoading || void 0,
|
|
3844
|
+
busy: pasteLoading,
|
|
3821
3845
|
onChange: (e) => setPasteText(e.target.value),
|
|
3822
3846
|
onKeyDown: (e) => {
|
|
3823
3847
|
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) {
|
|
@@ -3879,19 +3903,9 @@ function MultiSelectPanel({
|
|
|
3879
3903
|
{
|
|
3880
3904
|
size: "sm",
|
|
3881
3905
|
variant: "secondary",
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
e.preventDefault();
|
|
3886
|
-
return;
|
|
3887
|
-
}
|
|
3888
|
-
doResolve();
|
|
3889
|
-
},
|
|
3890
|
-
onKeyDown: (e) => {
|
|
3891
|
-
if (resolveDisabled && (e.key === "Enter" || e.key === " ")) {
|
|
3892
|
-
e.preventDefault();
|
|
3893
|
-
}
|
|
3894
|
-
},
|
|
3906
|
+
disabled: resolveDisabled,
|
|
3907
|
+
focusableWhenDisabled: true,
|
|
3908
|
+
onClick: doResolve,
|
|
3895
3909
|
children: pasteLoading ? "Resolving\u2026" : "Resolve"
|
|
3896
3910
|
}
|
|
3897
3911
|
) : void 0;
|
|
@@ -4028,16 +4042,6 @@ function RangePanel({
|
|
|
4028
4042
|
setDraft(next);
|
|
4029
4043
|
publish();
|
|
4030
4044
|
};
|
|
4031
|
-
const doneClick = (e) => {
|
|
4032
|
-
if (doneDisabled) {
|
|
4033
|
-
e.preventDefault();
|
|
4034
|
-
return;
|
|
4035
|
-
}
|
|
4036
|
-
onClose();
|
|
4037
|
-
};
|
|
4038
|
-
const doneKeyDown = (e) => {
|
|
4039
|
-
if (doneDisabled && (e.key === "Enter" || e.key === " ")) e.preventDefault();
|
|
4040
|
-
};
|
|
4041
4045
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
4042
4046
|
Popover,
|
|
4043
4047
|
{
|
|
@@ -4048,7 +4052,7 @@ function RangePanel({
|
|
|
4048
4052
|
offset: 6,
|
|
4049
4053
|
width: PANEL_WIDTH.range,
|
|
4050
4054
|
label: field.label,
|
|
4051
|
-
footer: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Button, { size: "sm", variant: "secondary",
|
|
4055
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Button, { size: "sm", variant: "secondary", disabled: doneDisabled, focusableWhenDisabled: true, onClick: onClose, children: "Done" }),
|
|
4052
4056
|
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "fd-stack fd-gap-sm", children: [
|
|
4053
4057
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { ref: minWrapRef, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
4054
4058
|
NumberInput,
|
|
@@ -4163,16 +4167,12 @@ function DatePanel({
|
|
|
4163
4167
|
};
|
|
4164
4168
|
const doneDisabled = kind === "withinDays" && !validity.allValid();
|
|
4165
4169
|
const confirm = () => {
|
|
4166
|
-
if (doneDisabled) return;
|
|
4167
4170
|
if (kind === "withinDays") {
|
|
4168
4171
|
const shown = shownWithinDays();
|
|
4169
4172
|
if (shown) onCommit(shown);
|
|
4170
4173
|
}
|
|
4171
4174
|
onClose();
|
|
4172
4175
|
};
|
|
4173
|
-
const doneKeyDown = (e) => {
|
|
4174
|
-
if (doneDisabled && (e.key === "Enter" || e.key === " ")) e.preventDefault();
|
|
4175
|
-
};
|
|
4176
4176
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
4177
4177
|
Popover,
|
|
4178
4178
|
{
|
|
@@ -4183,7 +4183,7 @@ function DatePanel({
|
|
|
4183
4183
|
offset: 6,
|
|
4184
4184
|
width: PANEL_WIDTH.date,
|
|
4185
4185
|
label: field.label,
|
|
4186
|
-
footer: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Button, { size: "sm", variant: "secondary",
|
|
4186
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Button, { size: "sm", variant: "secondary", disabled: doneDisabled, focusableWhenDisabled: true, onClick: confirm, children: "Done" }),
|
|
4187
4187
|
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "fd-stack fd-gap-sm", children: [
|
|
4188
4188
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
4189
4189
|
SegmentedControl,
|