@particle-academy/react-fancy 4.16.0 → 4.17.1

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
@@ -1831,10 +1831,19 @@ interface BreadcrumbsItemProps {
1831
1831
  children: ReactNode;
1832
1832
  href?: string;
1833
1833
  active?: boolean;
1834
+ /**
1835
+ * Navigate by callback instead of by URL, for a crumb with no href.
1836
+ *
1837
+ * Controlled components own their own navigation — a repository browser
1838
+ * walking directories, a wizard stepping back — and have no address to link
1839
+ * to. Renders the crumb as a `<button>`. Ignored when `active`, since the
1840
+ * current crumb is not a destination, and `href` wins if both are given.
1841
+ */
1842
+ onClick?: () => void;
1834
1843
  className?: string;
1835
1844
  }
1836
1845
 
1837
- declare function BreadcrumbsItem({ children, href, active, className, }: BreadcrumbsItemProps): react.JSX.Element;
1846
+ declare function BreadcrumbsItem({ children, href, active, onClick, className, }: BreadcrumbsItemProps): react.JSX.Element;
1838
1847
  declare namespace BreadcrumbsItem {
1839
1848
  var displayName: string;
1840
1849
  }
package/dist/index.d.ts CHANGED
@@ -1831,10 +1831,19 @@ interface BreadcrumbsItemProps {
1831
1831
  children: ReactNode;
1832
1832
  href?: string;
1833
1833
  active?: boolean;
1834
+ /**
1835
+ * Navigate by callback instead of by URL, for a crumb with no href.
1836
+ *
1837
+ * Controlled components own their own navigation — a repository browser
1838
+ * walking directories, a wizard stepping back — and have no address to link
1839
+ * to. Renders the crumb as a `<button>`. Ignored when `active`, since the
1840
+ * current crumb is not a destination, and `href` wins if both are given.
1841
+ */
1842
+ onClick?: () => void;
1834
1843
  className?: string;
1835
1844
  }
1836
1845
 
1837
- declare function BreadcrumbsItem({ children, href, active, className, }: BreadcrumbsItemProps): react.JSX.Element;
1846
+ declare function BreadcrumbsItem({ children, href, active, onClick, className, }: BreadcrumbsItemProps): react.JSX.Element;
1838
1847
  declare namespace BreadcrumbsItem {
1839
1848
  var displayName: string;
1840
1849
  }
package/dist/index.js CHANGED
@@ -9349,6 +9349,7 @@ function BreadcrumbsItem({
9349
9349
  children,
9350
9350
  href,
9351
9351
  active = false,
9352
+ onClick,
9352
9353
  className
9353
9354
  }) {
9354
9355
  const baseClass = cn(
@@ -9359,6 +9360,18 @@ function BreadcrumbsItem({
9359
9360
  if (href && !active) {
9360
9361
  return /* @__PURE__ */ jsx("a", { "data-react-fancy-breadcrumbs-item": "", href, className: baseClass, children });
9361
9362
  }
9363
+ if (onClick && !active) {
9364
+ return /* @__PURE__ */ jsx(
9365
+ "button",
9366
+ {
9367
+ type: "button",
9368
+ "data-react-fancy-breadcrumbs-item": "",
9369
+ onClick,
9370
+ className: cn(baseClass, "cursor-pointer border-0 bg-transparent p-0"),
9371
+ children
9372
+ }
9373
+ );
9374
+ }
9362
9375
  return /* @__PURE__ */ jsx("span", { "data-react-fancy-breadcrumbs-item": "", className: baseClass, "aria-current": active ? "page" : void 0, children });
9363
9376
  }
9364
9377
  BreadcrumbsItem.displayName = "BreadcrumbsItem";
@@ -10238,6 +10251,29 @@ var TimePicker = forwardRef(
10238
10251
  const { hours: h24, minutes } = parseTime(value);
10239
10252
  const isPM = h24 >= 12;
10240
10253
  const displayHour = format === "12h" ? h24 % 12 || 12 : h24;
10254
+ const updateTime = useCallback(
10255
+ (hours, mins) => {
10256
+ setValue(`${pad(hours)}:${pad(mins)}`);
10257
+ },
10258
+ [setValue]
10259
+ );
10260
+ const changeHour = useCallback(
10261
+ (delta) => {
10262
+ const newHour = (h24 + delta + 24) % 24;
10263
+ updateTime(newHour, minutes);
10264
+ },
10265
+ [h24, minutes, updateTime]
10266
+ );
10267
+ const changeMinute = useCallback(
10268
+ (delta) => {
10269
+ const newMin = (minutes + delta + 60) % 60;
10270
+ updateTime(h24, newMin);
10271
+ },
10272
+ [h24, minutes, updateTime]
10273
+ );
10274
+ const toggleAmPm = useCallback(() => {
10275
+ updateTime((h24 + 12) % 24, minutes);
10276
+ }, [h24, minutes, updateTime]);
10241
10277
  if (!showControl) {
10242
10278
  const formatted = format === "12h" ? `${pad(displayHour)}:${pad(minutes)} ${isPM ? "PM" : "AM"}` : `${pad(displayHour)}:${pad(minutes)}`;
10243
10279
  return /* @__PURE__ */ jsx(
@@ -10265,29 +10301,6 @@ var TimePicker = forwardRef(
10265
10301
  }
10266
10302
  );
10267
10303
  }
10268
- const updateTime = useCallback(
10269
- (hours, mins) => {
10270
- setValue(`${pad(hours)}:${pad(mins)}`);
10271
- },
10272
- [setValue]
10273
- );
10274
- const changeHour = useCallback(
10275
- (delta) => {
10276
- const newHour = (h24 + delta + 24) % 24;
10277
- updateTime(newHour, minutes);
10278
- },
10279
- [h24, minutes, updateTime]
10280
- );
10281
- const changeMinute = useCallback(
10282
- (delta) => {
10283
- const newMin = (minutes + delta + 60) % 60;
10284
- updateTime(h24, newMin);
10285
- },
10286
- [h24, minutes, updateTime]
10287
- );
10288
- const toggleAmPm = useCallback(() => {
10289
- updateTime((h24 + 12) % 24, minutes);
10290
- }, [h24, minutes, updateTime]);
10291
10304
  const spinBtnClass = "flex h-7 w-full items-center justify-center rounded text-zinc-400 transition-colors hover:bg-zinc-100 hover:text-zinc-600 dark:hover:bg-zinc-800 dark:hover:text-zinc-300 disabled:opacity-50";
10292
10305
  const displayClass = "flex h-10 w-12 items-center justify-center text-lg font-medium tabular-nums";
10293
10306
  return /* @__PURE__ */ jsxs(