@fewchurs/react 1.1.0 → 1.2.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.mjs CHANGED
@@ -4,7 +4,7 @@
4
4
  import { createContext, useContext, useEffect, useMemo, useRef, useState } from "react";
5
5
 
6
6
  // src/client/version.ts
7
- var SDK_VERSION = "1.1.0";
7
+ var SDK_VERSION = "1.2.0";
8
8
 
9
9
  // src/client/constants.ts
10
10
  var SDK_HEADER = `react/${SDK_VERSION}`;
@@ -1649,6 +1649,7 @@ function FewchursBoardDialog({
1649
1649
  open,
1650
1650
  onClose,
1651
1651
  ariaLabel = "Feature requests",
1652
+ variant = "dialog",
1652
1653
  ...boardProps
1653
1654
  }) {
1654
1655
  const dialogRef = useRef2(null);
@@ -1667,11 +1668,14 @@ function FewchursBoardDialog({
1667
1668
  };
1668
1669
  }, [open, onClose]);
1669
1670
  if (!open) return null;
1670
- return /* @__PURE__ */ jsx12("div", { className: "fw-overlay", onClick: onClose, children: /* @__PURE__ */ jsxs9(
1671
+ const isSheet = variant === "sheet";
1672
+ const { colorScheme } = boardProps;
1673
+ return /* @__PURE__ */ jsx12("div", { className: isSheet ? "fw-overlay fw-overlay--sheet" : "fw-overlay", onClick: onClose, children: /* @__PURE__ */ jsxs9(
1671
1674
  "div",
1672
1675
  {
1673
1676
  ref: dialogRef,
1674
- className: "fw-dialog",
1677
+ className: isSheet ? "fw-dialog fw-dialog--sheet" : "fw-dialog",
1678
+ "data-theme": colorScheme === "system" ? void 0 : colorScheme,
1675
1679
  role: "dialog",
1676
1680
  "aria-modal": "true",
1677
1681
  "aria-label": ariaLabel,
@@ -1684,6 +1688,49 @@ function FewchursBoardDialog({
1684
1688
  }
1685
1689
  ) });
1686
1690
  }
1691
+
1692
+ // src/components/BoardButton.tsx
1693
+ import { useCallback as useCallback7, useState as useState11 } from "react";
1694
+ import { createPortal } from "react-dom";
1695
+ import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
1696
+ function FewchursButton({
1697
+ children = "Feedback",
1698
+ className,
1699
+ style,
1700
+ ariaLabel,
1701
+ ...board
1702
+ }) {
1703
+ const [open, setOpen] = useState11(false);
1704
+ const close = useCallback7(() => setOpen(false), []);
1705
+ const classes = [board.unstyled ? "" : "fw-launcher", className].filter(Boolean).join(" ");
1706
+ return /* @__PURE__ */ jsxs10(Fragment3, { children: [
1707
+ /* @__PURE__ */ jsx13(
1708
+ "button",
1709
+ {
1710
+ type: "button",
1711
+ className: classes || void 0,
1712
+ style: { ...themeToStyle(board.theme), ...style },
1713
+ "aria-haspopup": "dialog",
1714
+ "aria-expanded": open,
1715
+ onClick: () => setOpen(true),
1716
+ children
1717
+ }
1718
+ ),
1719
+ open ? createPortal(
1720
+ /* @__PURE__ */ jsx13(
1721
+ FewchursBoardDialog,
1722
+ {
1723
+ ...board,
1724
+ variant: "sheet",
1725
+ ariaLabel,
1726
+ open: true,
1727
+ onClose: close
1728
+ }
1729
+ ),
1730
+ document.body
1731
+ ) : null
1732
+ ] });
1733
+ }
1687
1734
  export {
1688
1735
  BoardRoot,
1689
1736
  BoardTabs,
@@ -1698,6 +1745,7 @@ export {
1698
1745
  FeatureList,
1699
1746
  FewchursBoard,
1700
1747
  FewchursBoardDialog,
1748
+ FewchursButton,
1701
1749
  FewchursProvider,
1702
1750
  FollowForm,
1703
1751
  LIMITS,