@processdynamics/components 0.1.8 → 0.1.9
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/README.md +1 -0
- package/dist/index.cjs +26 -0
- package/dist/index.d.cts +25 -3
- package/dist/index.d.ts +25 -3
- package/dist/index.js +25 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -201,6 +201,7 @@ The packages the components import are declared as `peerDependencies` in `packag
|
|
|
201
201
|
- `class-variance-authority` for button variants
|
|
202
202
|
- `cn` for class merging
|
|
203
203
|
- `sonner` for the toaster
|
|
204
|
+
- `next` for the footer navigation's links and current path
|
|
204
205
|
|
|
205
206
|
They are also dev dependencies here so Storybook and the tests can run.
|
|
206
207
|
|
package/dist/index.cjs
CHANGED
|
@@ -33,6 +33,7 @@ var index_exports = {};
|
|
|
33
33
|
__export(index_exports, {
|
|
34
34
|
DatePicker: () => DatePicker,
|
|
35
35
|
DebouncedInput: () => DebouncedInput,
|
|
36
|
+
FooterNavigation: () => FooterNavigation,
|
|
36
37
|
JobCard: () => JobCard,
|
|
37
38
|
PullToRefreshArea: () => PullToRefreshArea,
|
|
38
39
|
Toaster: () => Toaster2,
|
|
@@ -935,10 +936,35 @@ function PullToRefreshArea({
|
|
|
935
936
|
children
|
|
936
937
|
] });
|
|
937
938
|
}
|
|
939
|
+
|
|
940
|
+
// src/components/footerNavigation/FooterNavigation.tsx
|
|
941
|
+
var import_link = __toESM(require("next/link"), 1);
|
|
942
|
+
var import_navigation = require("next/navigation");
|
|
943
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
944
|
+
function FooterNavigation({ onClick, navItems }) {
|
|
945
|
+
const pathname = (0, import_navigation.usePathname)();
|
|
946
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("nav", { className: "flex border-t border-gray-200 bg-white shrink-0", children: navItems.map(({ href, icon, label }) => {
|
|
947
|
+
const isActive = pathname === href;
|
|
948
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
949
|
+
import_link.default,
|
|
950
|
+
{
|
|
951
|
+
href,
|
|
952
|
+
onClick,
|
|
953
|
+
className: `flex-1 px-1 py-2.5 flex flex-col items-center gap-0.5 border-none bg-transparent cursor-pointer text-[10px] font-medium border-t-2 transition-colors ${isActive ? "text-primary border-t-primary" : "text-gray-500 border-t-transparent"}`,
|
|
954
|
+
children: [
|
|
955
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "text-xl leading-none", children: icon }),
|
|
956
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { children: label })
|
|
957
|
+
]
|
|
958
|
+
},
|
|
959
|
+
href
|
|
960
|
+
);
|
|
961
|
+
}) });
|
|
962
|
+
}
|
|
938
963
|
// Annotate the CommonJS export names for ESM import in node:
|
|
939
964
|
0 && (module.exports = {
|
|
940
965
|
DatePicker,
|
|
941
966
|
DebouncedInput,
|
|
967
|
+
FooterNavigation,
|
|
942
968
|
JobCard,
|
|
943
969
|
PullToRefreshArea,
|
|
944
970
|
Toaster,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ComponentProps, FocusEventHandler, ReactNode, CSSProperties } from 'react';
|
|
2
|
+
import { ComponentProps, FocusEventHandler, ReactNode, CSSProperties, MouseEventHandler } from 'react';
|
|
3
3
|
import { ToasterProps as ToasterProps$1 } from 'sonner';
|
|
4
4
|
export { toast } from 'sonner';
|
|
5
5
|
|
|
@@ -305,5 +305,27 @@ interface PullToRefreshAreaProps {
|
|
|
305
305
|
*/
|
|
306
306
|
declare function PullToRefreshArea({ isEnabled, onRefresh, onReload, className, children, }: PullToRefreshAreaProps): react.JSX.Element;
|
|
307
307
|
|
|
308
|
-
|
|
309
|
-
|
|
308
|
+
/** One tab in the footer navigation. */
|
|
309
|
+
type FooterNavigationItem = {
|
|
310
|
+
/** Where the tab links to. The tab is active when this matches the current path exactly. */
|
|
311
|
+
href: string;
|
|
312
|
+
/** What shows above the label: an emoji or text, or any element such as an icon. */
|
|
313
|
+
icon: string | ReactNode;
|
|
314
|
+
/** The tab's text, shown under the icon. */
|
|
315
|
+
label: string;
|
|
316
|
+
};
|
|
317
|
+
interface FooterNavigationProps {
|
|
318
|
+
/** The tabs, in the order they show. Each `href` should be unique, because it is the React key. */
|
|
319
|
+
navItems: FooterNavigationItem[];
|
|
320
|
+
/** Called when any tab is clicked, before the navigation happens. Not controlled: the link still navigates. */
|
|
321
|
+
onClick: MouseEventHandler<HTMLAnchorElement>;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* A row of equal-width tabs for the foot of a phone-sized screen. The tab whose
|
|
325
|
+
* `href` matches the current path is highlighted with the primary colour.
|
|
326
|
+
* It reads the path from the Next router, so it must render inside a Next app.
|
|
327
|
+
*/
|
|
328
|
+
declare function FooterNavigation({ onClick, navItems }: FooterNavigationProps): react.JSX.Element;
|
|
329
|
+
|
|
330
|
+
export { DatePicker, DebouncedInput, FooterNavigation, JobCard, PullToRefreshArea, Toaster, toastColors };
|
|
331
|
+
export type { DebouncedInputProps, FooterNavigationItem, FooterNavigationProps, JobCardAction, JobCardBadge, JobCardBanner, JobCardColor, JobCardData, JobCardPill, JobCardPillTone, JobCardProps, JobCardStage, JobCardTone, PullPhase, PullToRefreshAreaProps, RefreshOutcome, ToastColors, ToasterProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { ComponentProps, FocusEventHandler, ReactNode, CSSProperties } from 'react';
|
|
2
|
+
import { ComponentProps, FocusEventHandler, ReactNode, CSSProperties, MouseEventHandler } from 'react';
|
|
3
3
|
import { ToasterProps as ToasterProps$1 } from 'sonner';
|
|
4
4
|
export { toast } from 'sonner';
|
|
5
5
|
|
|
@@ -305,5 +305,27 @@ interface PullToRefreshAreaProps {
|
|
|
305
305
|
*/
|
|
306
306
|
declare function PullToRefreshArea({ isEnabled, onRefresh, onReload, className, children, }: PullToRefreshAreaProps): react.JSX.Element;
|
|
307
307
|
|
|
308
|
-
|
|
309
|
-
|
|
308
|
+
/** One tab in the footer navigation. */
|
|
309
|
+
type FooterNavigationItem = {
|
|
310
|
+
/** Where the tab links to. The tab is active when this matches the current path exactly. */
|
|
311
|
+
href: string;
|
|
312
|
+
/** What shows above the label: an emoji or text, or any element such as an icon. */
|
|
313
|
+
icon: string | ReactNode;
|
|
314
|
+
/** The tab's text, shown under the icon. */
|
|
315
|
+
label: string;
|
|
316
|
+
};
|
|
317
|
+
interface FooterNavigationProps {
|
|
318
|
+
/** The tabs, in the order they show. Each `href` should be unique, because it is the React key. */
|
|
319
|
+
navItems: FooterNavigationItem[];
|
|
320
|
+
/** Called when any tab is clicked, before the navigation happens. Not controlled: the link still navigates. */
|
|
321
|
+
onClick: MouseEventHandler<HTMLAnchorElement>;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* A row of equal-width tabs for the foot of a phone-sized screen. The tab whose
|
|
325
|
+
* `href` matches the current path is highlighted with the primary colour.
|
|
326
|
+
* It reads the path from the Next router, so it must render inside a Next app.
|
|
327
|
+
*/
|
|
328
|
+
declare function FooterNavigation({ onClick, navItems }: FooterNavigationProps): react.JSX.Element;
|
|
329
|
+
|
|
330
|
+
export { DatePicker, DebouncedInput, FooterNavigation, JobCard, PullToRefreshArea, Toaster, toastColors };
|
|
331
|
+
export type { DebouncedInputProps, FooterNavigationItem, FooterNavigationProps, JobCardAction, JobCardBadge, JobCardBanner, JobCardColor, JobCardData, JobCardPill, JobCardPillTone, JobCardProps, JobCardStage, JobCardTone, PullPhase, PullToRefreshAreaProps, RefreshOutcome, ToastColors, ToasterProps };
|
package/dist/index.js
CHANGED
|
@@ -901,9 +901,34 @@ function PullToRefreshArea({
|
|
|
901
901
|
children
|
|
902
902
|
] });
|
|
903
903
|
}
|
|
904
|
+
|
|
905
|
+
// src/components/footerNavigation/FooterNavigation.tsx
|
|
906
|
+
import Link from "next/link";
|
|
907
|
+
import { usePathname } from "next/navigation";
|
|
908
|
+
import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
909
|
+
function FooterNavigation({ onClick, navItems }) {
|
|
910
|
+
const pathname = usePathname();
|
|
911
|
+
return /* @__PURE__ */ jsx14("nav", { className: "flex border-t border-gray-200 bg-white shrink-0", children: navItems.map(({ href, icon, label }) => {
|
|
912
|
+
const isActive = pathname === href;
|
|
913
|
+
return /* @__PURE__ */ jsxs7(
|
|
914
|
+
Link,
|
|
915
|
+
{
|
|
916
|
+
href,
|
|
917
|
+
onClick,
|
|
918
|
+
className: `flex-1 px-1 py-2.5 flex flex-col items-center gap-0.5 border-none bg-transparent cursor-pointer text-[10px] font-medium border-t-2 transition-colors ${isActive ? "text-primary border-t-primary" : "text-gray-500 border-t-transparent"}`,
|
|
919
|
+
children: [
|
|
920
|
+
/* @__PURE__ */ jsx14("span", { className: "text-xl leading-none", children: icon }),
|
|
921
|
+
/* @__PURE__ */ jsx14("span", { children: label })
|
|
922
|
+
]
|
|
923
|
+
},
|
|
924
|
+
href
|
|
925
|
+
);
|
|
926
|
+
}) });
|
|
927
|
+
}
|
|
904
928
|
export {
|
|
905
929
|
DatePicker,
|
|
906
930
|
DebouncedInput,
|
|
931
|
+
FooterNavigation,
|
|
907
932
|
JobCard,
|
|
908
933
|
PullToRefreshArea,
|
|
909
934
|
Toaster2 as Toaster,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@processdynamics/components",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Process Dynamics React component library, built on shadcn (Radix) and Tailwind CSS v4.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -99,6 +99,7 @@
|
|
|
99
99
|
"cn": "^0.5.2",
|
|
100
100
|
"date-fns": "^4.4.0",
|
|
101
101
|
"lucide-react": "^1.66.0",
|
|
102
|
+
"next": "^16.0.0",
|
|
102
103
|
"radix-ui": "^1.8.1",
|
|
103
104
|
"react": "^19.0.0",
|
|
104
105
|
"react-day-picker": "^10.0.2",
|