@flytedan/flytebot-design-system 0.38.0 → 0.40.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.d.cts CHANGED
@@ -20,14 +20,14 @@ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
20
20
  block?: boolean;
21
21
  as?: "button" | "a";
22
22
  /** When `disabled` (or `loading`), stay in the tab order instead of going natively
23
- * `disabled`: renders `aria-disabled="true"` rather than the `disabled` attribute,
24
- * keeps the `:focus-visible` ring, and swallows click/Enter/Space without ever
25
- * submitting a form. Use whenever a button's disabled state can flip while it holds
26
- * focus (e.g. a controlled panel re-seeding mid-edit) — a native `disabled` drops focus
27
- * to `<body>` the instant it applies, and nothing can intercept or redirect that.
28
- * Also makes `aria-disabled` always explicit ("true"/"false", never absent): since the
29
- * browser can no longer tell assistive tech this button's state from `disabled` itself,
30
- * the ARIA state has to say so on its own at every render, not only while disabled. */
23
+ * `disabled`: renders `aria-disabled="true"` only while actually disabled/loading (never
24
+ * the `disabled` attribute), keeps the `:focus-visible` ring, and swallows
25
+ * click/Enter/Space — including never letting a click bubble to an ancestor's own
26
+ * handler — without ever submitting a form. Use whenever a button's disabled state can
27
+ * flip while it holds focus (e.g. a controlled panel re-seeding mid-edit) — a native
28
+ * `disabled` drops focus to `<body>` the instant it applies, and nothing can intercept or
29
+ * redirect that. Once enabled again, this behaves exactly like a plain button: no
30
+ * `aria-disabled` attribute at all. */
31
31
  focusableWhenDisabled?: boolean;
32
32
  }
33
33
  declare function Button({ children, variant, size, icon, trailingIcon, arrow, loading, disabled, focusableWhenDisabled, block, as, className, onClick, onKeyDown, ...rest }: ButtonProps): React.JSX.Element;
package/dist/index.d.ts CHANGED
@@ -20,14 +20,14 @@ interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
20
20
  block?: boolean;
21
21
  as?: "button" | "a";
22
22
  /** When `disabled` (or `loading`), stay in the tab order instead of going natively
23
- * `disabled`: renders `aria-disabled="true"` rather than the `disabled` attribute,
24
- * keeps the `:focus-visible` ring, and swallows click/Enter/Space without ever
25
- * submitting a form. Use whenever a button's disabled state can flip while it holds
26
- * focus (e.g. a controlled panel re-seeding mid-edit) — a native `disabled` drops focus
27
- * to `<body>` the instant it applies, and nothing can intercept or redirect that.
28
- * Also makes `aria-disabled` always explicit ("true"/"false", never absent): since the
29
- * browser can no longer tell assistive tech this button's state from `disabled` itself,
30
- * the ARIA state has to say so on its own at every render, not only while disabled. */
23
+ * `disabled`: renders `aria-disabled="true"` only while actually disabled/loading (never
24
+ * the `disabled` attribute), keeps the `:focus-visible` ring, and swallows
25
+ * click/Enter/Space — including never letting a click bubble to an ancestor's own
26
+ * handler — without ever submitting a form. Use whenever a button's disabled state can
27
+ * flip while it holds focus (e.g. a controlled panel re-seeding mid-edit) — a native
28
+ * `disabled` drops focus to `<body>` the instant it applies, and nothing can intercept or
29
+ * redirect that. Once enabled again, this behaves exactly like a plain button: no
30
+ * `aria-disabled` attribute at all. */
31
31
  focusableWhenDisabled?: boolean;
32
32
  }
33
33
  declare function Button({ children, variant, size, icon, trailingIcon, arrow, loading, disabled, focusableWhenDisabled, block, as, className, onClick, onKeyDown, ...rest }: ButtonProps): React.JSX.Element;
package/dist/index.js CHANGED
@@ -8,9 +8,6 @@ var VARIANTS = {
8
8
  danger: "fd-btn-danger",
9
9
  link: "fd-btn-link"
10
10
  };
11
- function isActivationKey(key) {
12
- return key === "Enter" || key === " ";
13
- }
14
11
  function Button({
15
12
  children,
16
13
  variant = "primary",
@@ -43,15 +40,13 @@ function Button({
43
40
  {
44
41
  className: cls,
45
42
  disabled: Tag2 === "button" ? (disabled || loading) && !focusableWhenDisabled : void 0,
46
- "aria-disabled": focusableWhenDisabled ? String(disabled || loading) : disabled || loading ? "true" : void 0,
43
+ "aria-disabled": disabled || loading ? "true" : void 0,
47
44
  "aria-busy": loading ? "true" : void 0,
48
45
  onClick: inert ? (e) => {
49
46
  e.preventDefault();
47
+ e.stopPropagation();
50
48
  } : onClick,
51
- onKeyDown: inert ? (e) => {
52
- if (isActivationKey(e.key)) e.preventDefault();
53
- onKeyDown?.(e);
54
- } : onKeyDown,
49
+ onKeyDown,
55
50
  ...rest,
56
51
  children: [
57
52
  icon && !loading ? /* @__PURE__ */ jsx("i", { className: "ph ph-" + icon, "aria-hidden": "true" }) : null,