@jfdevelops/react-layout-composable-navigation 0.0.0 → 0.1.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/README.md +52 -2
- package/dist/breadcrumb.cjs +12 -0
- package/dist/breadcrumb.cjs.map +1 -0
- package/dist/breadcrumb.d.cts +10 -0
- package/dist/breadcrumb.d.cts.map +1 -0
- package/dist/breadcrumb.d.mts +10 -0
- package/dist/breadcrumb.d.mts.map +1 -0
- package/dist/breadcrumb.mjs +12 -0
- package/dist/breadcrumb.mjs.map +1 -0
- package/dist/contract.cjs +35 -0
- package/dist/contract.cjs.map +1 -0
- package/dist/contract.d.cts +20 -0
- package/dist/contract.d.cts.map +1 -0
- package/dist/contract.d.mts +20 -0
- package/dist/contract.d.mts.map +1 -0
- package/dist/contract.mjs +34 -0
- package/dist/contract.mjs.map +1 -0
- package/dist/index.cjs +6 -0
- package/dist/index.d.cts +4 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.mjs +4 -0
- package/dist/tabs.cjs +12 -0
- package/dist/tabs.cjs.map +1 -0
- package/dist/tabs.d.cts +10 -0
- package/dist/tabs.d.cts.map +1 -0
- package/dist/tabs.d.mts +10 -0
- package/dist/tabs.d.mts.map +1 -0
- package/dist/tabs.mjs +12 -0
- package/dist/tabs.mjs.map +1 -0
- package/package.json +63 -4
package/README.md
CHANGED
|
@@ -1,3 +1,53 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Navigation composables
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Preset composables for lists of navigation items. Each one ships its props, so
|
|
4
|
+
a page supplies the items and your render callback supplies the markup.
|
|
5
|
+
|
|
6
|
+
```tsx
|
|
7
|
+
import {
|
|
8
|
+
createBreadcrumbComposable,
|
|
9
|
+
createTabsComposable,
|
|
10
|
+
} from '@jfdevelops/react-layout-composable-navigation';
|
|
11
|
+
|
|
12
|
+
composables: (create) => ({
|
|
13
|
+
Layout: create({ name: 'Layout' }),
|
|
14
|
+
...createBreadcrumbComposable(({ segments }) => (
|
|
15
|
+
<AppBreadcrumb segments={segments} />
|
|
16
|
+
)),
|
|
17
|
+
...createTabsComposable(({ tabs }) => <AppTabs tabs={tabs} />),
|
|
18
|
+
});
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
| Factory | Component | Prop |
|
|
22
|
+
| ---------------------------- | ------------ | ---------- |
|
|
23
|
+
| `createBreadcrumbComposable` | `Breadcrumb` | `segments` |
|
|
24
|
+
| `createTabsComposable` | `Tabs` | `tabs` |
|
|
25
|
+
|
|
26
|
+
Both props use the same item record, keyed by a stable id:
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
type NavigationItem =
|
|
30
|
+
| string
|
|
31
|
+
| { value: string; href?: string; isActive?: boolean; isDisabled?: boolean };
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## The contract
|
|
35
|
+
|
|
36
|
+
Both presets are built from the navigation contract, exported from the
|
|
37
|
+
`/contract` entry point. Use it directly for a list named `items`, or `extend`
|
|
38
|
+
it for a list with its own component and prop name:
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { createNavigationComposable } from '@jfdevelops/react-layout-composable-navigation/contract';
|
|
42
|
+
|
|
43
|
+
export const createStepsComposable = createNavigationComposable.extend({
|
|
44
|
+
name: 'Steps',
|
|
45
|
+
rename: { items: 'steps' },
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The item definition is available as `createNavigationComposable.props.items`.
|
|
50
|
+
|
|
51
|
+
Every factory also accepts the object overload from
|
|
52
|
+
`defineComposableComponent`, including `rename`, `props`, `name`, and
|
|
53
|
+
`wrapWith`.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const require_contract = require('./contract.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/breadcrumb.ts
|
|
4
|
+
/** Navigation items for the path to the current page, supplied as `segments`. */
|
|
5
|
+
const createBreadcrumbComposable = require_contract.createNavigationComposable.extend({
|
|
6
|
+
name: "Breadcrumb",
|
|
7
|
+
rename: { items: "segments" }
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.createBreadcrumbComposable = createBreadcrumbComposable;
|
|
12
|
+
//# sourceMappingURL=breadcrumb.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumb.cjs","names":["createNavigationComposable"],"sources":["../src/breadcrumb.ts"],"sourcesContent":["import { createNavigationComposable } from './contract';\n\n/** Navigation items for the path to the current page, supplied as `segments`. */\nexport const createBreadcrumbComposable = createNavigationComposable.extend({\n name: 'Breadcrumb',\n rename: {\n items: 'segments',\n },\n});\n"],"mappings":";;;;AAGA,MAAa,6BAA6BA,4CAA2B,OAAO;CAC1E,MAAM;CACN,QAAQ,EACN,OAAO,WACT;AACF,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NavigationItems } from "./contract.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/breadcrumb.d.ts
|
|
4
|
+
/** Navigation items for the path to the current page, supplied as `segments`. */
|
|
5
|
+
declare const createBreadcrumbComposable: import("@jfdevelops/react-layout-composables").DefinedComposableComponentFactory<"Breadcrumb", Omit<{
|
|
6
|
+
segments: import("@jfdevelops/react-layout-validator").PropValidatorSchema<NavigationItems>;
|
|
7
|
+
}, never> & import("@jfdevelops/react-layout-composables").NormalizeComposableProps<{}>, undefined, {}>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { createBreadcrumbComposable };
|
|
10
|
+
//# sourceMappingURL=breadcrumb.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumb.d.cts","names":[],"sources":["../src/breadcrumb.ts"],"mappings":";;;;cAGa,0BAAA,iDAA0B,iCAAA,eAAA,IAAA;6EAKrC,eAAA;AAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NavigationItems } from "./contract.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/breadcrumb.d.ts
|
|
4
|
+
/** Navigation items for the path to the current page, supplied as `segments`. */
|
|
5
|
+
declare const createBreadcrumbComposable: import("@jfdevelops/react-layout-composables").DefinedComposableComponentFactory<"Breadcrumb", Omit<{
|
|
6
|
+
segments: import("@jfdevelops/react-layout-validator").PropValidatorSchema<NavigationItems>;
|
|
7
|
+
}, never> & import("@jfdevelops/react-layout-composables").NormalizeComposableProps<{}>, undefined, {}>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { createBreadcrumbComposable };
|
|
10
|
+
//# sourceMappingURL=breadcrumb.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumb.d.mts","names":[],"sources":["../src/breadcrumb.ts"],"mappings":";;;;cAGa,0BAAA,iDAA0B,iCAAA,eAAA,IAAA;6EAKrC,eAAA;AAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createNavigationComposable } from "./contract.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/breadcrumb.ts
|
|
4
|
+
/** Navigation items for the path to the current page, supplied as `segments`. */
|
|
5
|
+
const createBreadcrumbComposable = createNavigationComposable.extend({
|
|
6
|
+
name: "Breadcrumb",
|
|
7
|
+
rename: { items: "segments" }
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { createBreadcrumbComposable };
|
|
12
|
+
//# sourceMappingURL=breadcrumb.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumb.mjs","names":[],"sources":["../src/breadcrumb.ts"],"sourcesContent":["import { createNavigationComposable } from './contract';\n\n/** Navigation items for the path to the current page, supplied as `segments`. */\nexport const createBreadcrumbComposable = createNavigationComposable.extend({\n name: 'Breadcrumb',\n rename: {\n items: 'segments',\n },\n});\n"],"mappings":";;;;AAGA,MAAa,6BAA6B,2BAA2B,OAAO;CAC1E,MAAM;CACN,QAAQ,EACN,OAAO,WACT;AACF,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
let _jfdevelops_react_layout_composables = require("@jfdevelops/react-layout-composables");
|
|
3
|
+
|
|
4
|
+
//#region src/contract.ts
|
|
5
|
+
function isRecord(value) {
|
|
6
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7
|
+
}
|
|
8
|
+
function isOptional(value, type) {
|
|
9
|
+
return value === void 0 || typeof value === type;
|
|
10
|
+
}
|
|
11
|
+
function isNavigationItem(item) {
|
|
12
|
+
if (typeof item === "string") return true;
|
|
13
|
+
return isRecord(item) && typeof item.value === "string" && isOptional(item.href, "string") && isOptional(item.isActive, "boolean") && isOptional(item.isDisabled, "boolean");
|
|
14
|
+
}
|
|
15
|
+
function assertNavigationItems(value, error) {
|
|
16
|
+
if (!isRecord(value)) throw error("Expected navigation items keyed by id");
|
|
17
|
+
const invalidKey = Object.keys(value).find((key) => !isNavigationItem(value[key]));
|
|
18
|
+
if (invalidKey !== void 0) throw error(`"${invalidKey}" is not a label or a navigation item`);
|
|
19
|
+
}
|
|
20
|
+
const items = (0, _jfdevelops_react_layout_composables.createPropValidator)(({ value, error }) => {
|
|
21
|
+
assertNavigationItems(value, error);
|
|
22
|
+
return value;
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* The navigation contract. Call it for a list named `items`, or `extend` it
|
|
26
|
+
* to give the list its own component and prop name.
|
|
27
|
+
*/
|
|
28
|
+
const createNavigationComposable = (0, _jfdevelops_react_layout_composables.defineComposableComponent)({
|
|
29
|
+
name: "Navigation",
|
|
30
|
+
props: { items }
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
exports.createNavigationComposable = createNavigationComposable;
|
|
35
|
+
//# sourceMappingURL=contract.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.cjs","names":[],"sources":["../src/contract.ts"],"sourcesContent":["import {\n createPropValidator,\n defineComposableComponent,\n type PropValidatorErrorHelper,\n} from '@jfdevelops/react-layout-composables';\n\n/** One navigation item: its label, or its label with a destination and state. */\nexport type NavigationItem =\n | string\n | {\n value: string;\n href?: string;\n isActive?: boolean;\n isDisabled?: boolean;\n };\n\n/** Navigation items keyed by a stable id. */\nexport type NavigationItems = Record<string, NavigationItem>;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction isOptional(value: unknown, type: 'boolean' | 'string') {\n return value === undefined || typeof value === type;\n}\n\nfunction isNavigationItem(item: unknown) {\n if (typeof item === 'string') {\n return true;\n }\n\n return (\n isRecord(item) &&\n typeof item.value === 'string' &&\n isOptional(item.href, 'string') &&\n isOptional(item.isActive, 'boolean') &&\n isOptional(item.isDisabled, 'boolean')\n );\n}\n\nfunction assertNavigationItems(\n value: unknown,\n error: PropValidatorErrorHelper,\n): asserts value is NavigationItems {\n if (!isRecord(value)) {\n throw error('Expected navigation items keyed by id');\n }\n\n const invalidKey = Object.keys(value).find(\n (key) => !isNavigationItem(value[key]),\n );\n\n if (invalidKey !== undefined) {\n throw error(`\"${invalidKey}\" is not a label or a navigation item`);\n }\n}\n\nconst items = createPropValidator(({ value, error }) => {\n assertNavigationItems(value, error);\n\n return value;\n});\n\n/**\n * The navigation contract. Call it for a list named `items`, or `extend` it\n * to give the list its own component and prop name.\n */\nexport const createNavigationComposable = defineComposableComponent({\n name: 'Navigation',\n props: {\n items,\n },\n});\n"],"mappings":";;;;AAmBA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,WAAW,OAAgB,MAA4B;CAC9D,OAAO,UAAU,UAAa,OAAO,UAAU;AACjD;AAEA,SAAS,iBAAiB,MAAe;CACvC,IAAI,OAAO,SAAS,UAClB,OAAO;CAGT,OACE,SAAS,IAAI,KACb,OAAO,KAAK,UAAU,YACtB,WAAW,KAAK,MAAM,QAAQ,KAC9B,WAAW,KAAK,UAAU,SAAS,KACnC,WAAW,KAAK,YAAY,SAAS;AAEzC;AAEA,SAAS,sBACP,OACA,OACkC;CAClC,IAAI,CAAC,SAAS,KAAK,GACjB,MAAM,MAAM,uCAAuC;CAGrD,MAAM,aAAa,OAAO,KAAK,KAAK,EAAE,MACnC,QAAQ,CAAC,iBAAiB,MAAM,IAAI,CACvC;CAEA,IAAI,eAAe,QACjB,MAAM,MAAM,IAAI,WAAW,sCAAsC;AAErE;AAEA,MAAM,uEAA6B,EAAE,OAAO,YAAY;CACtD,sBAAsB,OAAO,KAAK;CAElC,OAAO;AACT,CAAC;;;;;AAMD,MAAa,iGAAuD;CAClE,MAAM;CACN,OAAO,EACL,MACF;AACF,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/contract.d.ts
|
|
2
|
+
/** One navigation item: its label, or its label with a destination and state. */
|
|
3
|
+
type NavigationItem = string | {
|
|
4
|
+
value: string;
|
|
5
|
+
href?: string;
|
|
6
|
+
isActive?: boolean;
|
|
7
|
+
isDisabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
/** Navigation items keyed by a stable id. */
|
|
10
|
+
type NavigationItems = Record<string, NavigationItem>;
|
|
11
|
+
/**
|
|
12
|
+
* The navigation contract. Call it for a list named `items`, or `extend` it
|
|
13
|
+
* to give the list its own component and prop name.
|
|
14
|
+
*/
|
|
15
|
+
declare const createNavigationComposable: import("@jfdevelops/react-layout-composables").DefinedComposableComponentFactory<"Navigation", import("@jfdevelops/react-layout-composables").NormalizeComposableProps<{
|
|
16
|
+
items: import("@jfdevelops/react-layout-validator").PropValidatorSchema<NavigationItems>;
|
|
17
|
+
}>, undefined, {}>;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { NavigationItem, NavigationItems, createNavigationComposable };
|
|
20
|
+
//# sourceMappingURL=contract.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.cts","names":[],"sources":["../src/contract.ts"],"mappings":";;KAOY,cAAA;EAGN,KAAA;EACA,IAAA;EACA,QAAA;EACA,UAAA;AAAA;;KAIM,eAAA,GAAkB,MAAM,SAAS,cAAA;;AAJ7B;AAIhB;;cAmDa,0BAAA,iDAA0B,iCAAA,8DAAA,wBAAA;0EAKrC,eAAA;AAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/contract.d.ts
|
|
2
|
+
/** One navigation item: its label, or its label with a destination and state. */
|
|
3
|
+
type NavigationItem = string | {
|
|
4
|
+
value: string;
|
|
5
|
+
href?: string;
|
|
6
|
+
isActive?: boolean;
|
|
7
|
+
isDisabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
/** Navigation items keyed by a stable id. */
|
|
10
|
+
type NavigationItems = Record<string, NavigationItem>;
|
|
11
|
+
/**
|
|
12
|
+
* The navigation contract. Call it for a list named `items`, or `extend` it
|
|
13
|
+
* to give the list its own component and prop name.
|
|
14
|
+
*/
|
|
15
|
+
declare const createNavigationComposable: import("@jfdevelops/react-layout-composables").DefinedComposableComponentFactory<"Navigation", import("@jfdevelops/react-layout-composables").NormalizeComposableProps<{
|
|
16
|
+
items: import("@jfdevelops/react-layout-validator").PropValidatorSchema<NavigationItems>;
|
|
17
|
+
}>, undefined, {}>;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { NavigationItem, NavigationItems, createNavigationComposable };
|
|
20
|
+
//# sourceMappingURL=contract.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.mts","names":[],"sources":["../src/contract.ts"],"mappings":";;KAOY,cAAA;EAGN,KAAA;EACA,IAAA;EACA,QAAA;EACA,UAAA;AAAA;;KAIM,eAAA,GAAkB,MAAM,SAAS,cAAA;;AAJ7B;AAIhB;;cAmDa,0BAAA,iDAA0B,iCAAA,8DAAA,wBAAA;0EAKrC,eAAA;AAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createPropValidator, defineComposableComponent } from "@jfdevelops/react-layout-composables";
|
|
2
|
+
|
|
3
|
+
//#region src/contract.ts
|
|
4
|
+
function isRecord(value) {
|
|
5
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6
|
+
}
|
|
7
|
+
function isOptional(value, type) {
|
|
8
|
+
return value === void 0 || typeof value === type;
|
|
9
|
+
}
|
|
10
|
+
function isNavigationItem(item) {
|
|
11
|
+
if (typeof item === "string") return true;
|
|
12
|
+
return isRecord(item) && typeof item.value === "string" && isOptional(item.href, "string") && isOptional(item.isActive, "boolean") && isOptional(item.isDisabled, "boolean");
|
|
13
|
+
}
|
|
14
|
+
function assertNavigationItems(value, error) {
|
|
15
|
+
if (!isRecord(value)) throw error("Expected navigation items keyed by id");
|
|
16
|
+
const invalidKey = Object.keys(value).find((key) => !isNavigationItem(value[key]));
|
|
17
|
+
if (invalidKey !== void 0) throw error(`"${invalidKey}" is not a label or a navigation item`);
|
|
18
|
+
}
|
|
19
|
+
const items = createPropValidator(({ value, error }) => {
|
|
20
|
+
assertNavigationItems(value, error);
|
|
21
|
+
return value;
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* The navigation contract. Call it for a list named `items`, or `extend` it
|
|
25
|
+
* to give the list its own component and prop name.
|
|
26
|
+
*/
|
|
27
|
+
const createNavigationComposable = defineComposableComponent({
|
|
28
|
+
name: "Navigation",
|
|
29
|
+
props: { items }
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
export { createNavigationComposable };
|
|
34
|
+
//# sourceMappingURL=contract.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.mjs","names":[],"sources":["../src/contract.ts"],"sourcesContent":["import {\n createPropValidator,\n defineComposableComponent,\n type PropValidatorErrorHelper,\n} from '@jfdevelops/react-layout-composables';\n\n/** One navigation item: its label, or its label with a destination and state. */\nexport type NavigationItem =\n | string\n | {\n value: string;\n href?: string;\n isActive?: boolean;\n isDisabled?: boolean;\n };\n\n/** Navigation items keyed by a stable id. */\nexport type NavigationItems = Record<string, NavigationItem>;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction isOptional(value: unknown, type: 'boolean' | 'string') {\n return value === undefined || typeof value === type;\n}\n\nfunction isNavigationItem(item: unknown) {\n if (typeof item === 'string') {\n return true;\n }\n\n return (\n isRecord(item) &&\n typeof item.value === 'string' &&\n isOptional(item.href, 'string') &&\n isOptional(item.isActive, 'boolean') &&\n isOptional(item.isDisabled, 'boolean')\n );\n}\n\nfunction assertNavigationItems(\n value: unknown,\n error: PropValidatorErrorHelper,\n): asserts value is NavigationItems {\n if (!isRecord(value)) {\n throw error('Expected navigation items keyed by id');\n }\n\n const invalidKey = Object.keys(value).find(\n (key) => !isNavigationItem(value[key]),\n );\n\n if (invalidKey !== undefined) {\n throw error(`\"${invalidKey}\" is not a label or a navigation item`);\n }\n}\n\nconst items = createPropValidator(({ value, error }) => {\n assertNavigationItems(value, error);\n\n return value;\n});\n\n/**\n * The navigation contract. Call it for a list named `items`, or `extend` it\n * to give the list its own component and prop name.\n */\nexport const createNavigationComposable = defineComposableComponent({\n name: 'Navigation',\n props: {\n items,\n },\n});\n"],"mappings":";;;AAmBA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;AAEA,SAAS,WAAW,OAAgB,MAA4B;CAC9D,OAAO,UAAU,UAAa,OAAO,UAAU;AACjD;AAEA,SAAS,iBAAiB,MAAe;CACvC,IAAI,OAAO,SAAS,UAClB,OAAO;CAGT,OACE,SAAS,IAAI,KACb,OAAO,KAAK,UAAU,YACtB,WAAW,KAAK,MAAM,QAAQ,KAC9B,WAAW,KAAK,UAAU,SAAS,KACnC,WAAW,KAAK,YAAY,SAAS;AAEzC;AAEA,SAAS,sBACP,OACA,OACkC;CAClC,IAAI,CAAC,SAAS,KAAK,GACjB,MAAM,MAAM,uCAAuC;CAGrD,MAAM,aAAa,OAAO,KAAK,KAAK,EAAE,MACnC,QAAQ,CAAC,iBAAiB,MAAM,IAAI,CACvC;CAEA,IAAI,eAAe,QACjB,MAAM,MAAM,IAAI,WAAW,sCAAsC;AAErE;AAEA,MAAM,QAAQ,qBAAqB,EAAE,OAAO,YAAY;CACtD,sBAAsB,OAAO,KAAK;CAElC,OAAO;AACT,CAAC;;;;;AAMD,MAAa,6BAA6B,0BAA0B;CAClE,MAAM;CACN,OAAO,EACL,MACF;AACF,CAAC"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_breadcrumb = require('./breadcrumb.cjs');
|
|
3
|
+
const require_tabs = require('./tabs.cjs');
|
|
4
|
+
|
|
5
|
+
exports.createBreadcrumbComposable = require_breadcrumb.createBreadcrumbComposable;
|
|
6
|
+
exports.createTabsComposable = require_tabs.createTabsComposable;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { NavigationItem, NavigationItems } from "./contract.cjs";
|
|
2
|
+
import { createBreadcrumbComposable } from "./breadcrumb.cjs";
|
|
3
|
+
import { createTabsComposable } from "./tabs.cjs";
|
|
4
|
+
export { type NavigationItem, type NavigationItems, createBreadcrumbComposable, createTabsComposable };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { NavigationItem, NavigationItems } from "./contract.mjs";
|
|
2
|
+
import { createBreadcrumbComposable } from "./breadcrumb.mjs";
|
|
3
|
+
import { createTabsComposable } from "./tabs.mjs";
|
|
4
|
+
export { type NavigationItem, type NavigationItems, createBreadcrumbComposable, createTabsComposable };
|
package/dist/index.mjs
ADDED
package/dist/tabs.cjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const require_contract = require('./contract.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/tabs.ts
|
|
4
|
+
/** Navigation items for sibling views of the current page, supplied as `tabs`. */
|
|
5
|
+
const createTabsComposable = require_contract.createNavigationComposable.extend({
|
|
6
|
+
name: "Tabs",
|
|
7
|
+
rename: { items: "tabs" }
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.createTabsComposable = createTabsComposable;
|
|
12
|
+
//# sourceMappingURL=tabs.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.cjs","names":["createNavigationComposable"],"sources":["../src/tabs.ts"],"sourcesContent":["import { createNavigationComposable } from './contract';\n\n/** Navigation items for sibling views of the current page, supplied as `tabs`. */\nexport const createTabsComposable = createNavigationComposable.extend({\n name: 'Tabs',\n rename: {\n items: 'tabs',\n },\n});\n"],"mappings":";;;;AAGA,MAAa,uBAAuBA,4CAA2B,OAAO;CACpE,MAAM;CACN,QAAQ,EACN,OAAO,OACT;AACF,CAAC"}
|
package/dist/tabs.d.cts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NavigationItems } from "./contract.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/tabs.d.ts
|
|
4
|
+
/** Navigation items for sibling views of the current page, supplied as `tabs`. */
|
|
5
|
+
declare const createTabsComposable: import("@jfdevelops/react-layout-composables").DefinedComposableComponentFactory<"Tabs", Omit<{
|
|
6
|
+
tabs: import("@jfdevelops/react-layout-validator").PropValidatorSchema<NavigationItems>;
|
|
7
|
+
}, never> & import("@jfdevelops/react-layout-composables").NormalizeComposableProps<{}>, undefined, {}>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { createTabsComposable };
|
|
10
|
+
//# sourceMappingURL=tabs.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.d.cts","names":[],"sources":["../src/tabs.ts"],"mappings":";;;;cAGa,oBAAA,iDAAoB,iCAAA,SAAA,IAAA;yEAK/B,eAAA;AAAA"}
|
package/dist/tabs.d.mts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NavigationItems } from "./contract.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/tabs.d.ts
|
|
4
|
+
/** Navigation items for sibling views of the current page, supplied as `tabs`. */
|
|
5
|
+
declare const createTabsComposable: import("@jfdevelops/react-layout-composables").DefinedComposableComponentFactory<"Tabs", Omit<{
|
|
6
|
+
tabs: import("@jfdevelops/react-layout-validator").PropValidatorSchema<NavigationItems>;
|
|
7
|
+
}, never> & import("@jfdevelops/react-layout-composables").NormalizeComposableProps<{}>, undefined, {}>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { createTabsComposable };
|
|
10
|
+
//# sourceMappingURL=tabs.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.d.mts","names":[],"sources":["../src/tabs.ts"],"mappings":";;;;cAGa,oBAAA,iDAAoB,iCAAA,SAAA,IAAA;yEAK/B,eAAA;AAAA"}
|
package/dist/tabs.mjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createNavigationComposable } from "./contract.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/tabs.ts
|
|
4
|
+
/** Navigation items for sibling views of the current page, supplied as `tabs`. */
|
|
5
|
+
const createTabsComposable = createNavigationComposable.extend({
|
|
6
|
+
name: "Tabs",
|
|
7
|
+
rename: { items: "tabs" }
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { createTabsComposable };
|
|
12
|
+
//# sourceMappingURL=tabs.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.mjs","names":[],"sources":["../src/tabs.ts"],"sourcesContent":["import { createNavigationComposable } from './contract';\n\n/** Navigation items for sibling views of the current page, supplied as `tabs`. */\nexport const createTabsComposable = createNavigationComposable.extend({\n name: 'Tabs',\n rename: {\n items: 'tabs',\n },\n});\n"],"mappings":";;;;AAGA,MAAa,uBAAuB,2BAA2B,OAAO;CACpE,MAAM;CACN,QAAQ,EACN,OAAO,OACT;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jfdevelops/react-layout-composable-navigation",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Navigation preset composables for react-layout: breadcrumb, tabs, and their shared contract.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/jfdevelops/react-layout.git",
|
|
8
|
+
"directory": "packages/composable-navigation"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"type": "module",
|
|
14
|
+
"sideEffects": false,
|
|
15
|
+
"main": "./dist/index.cjs",
|
|
16
|
+
"module": "./dist/index.mjs",
|
|
17
|
+
"types": "./dist/index.d.mts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.mts",
|
|
21
|
+
"import": "./dist/index.mjs",
|
|
22
|
+
"require": "./dist/index.cjs"
|
|
23
|
+
},
|
|
24
|
+
"./contract": {
|
|
25
|
+
"types": "./dist/contract.d.mts",
|
|
26
|
+
"import": "./dist/contract.mjs",
|
|
27
|
+
"require": "./dist/contract.cjs"
|
|
28
|
+
},
|
|
29
|
+
"./package.json": "./package.json"
|
|
30
|
+
},
|
|
6
31
|
"publishConfig": {
|
|
7
|
-
"access": "public"
|
|
32
|
+
"access": "public",
|
|
33
|
+
"provenance": true
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@jfdevelops/react-layout-composables": "1.1.0",
|
|
37
|
+
"@jfdevelops/react-layout-validator": "1.1.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@testing-library/jest-dom": "6.9.1",
|
|
41
|
+
"@testing-library/react": "16.3.2",
|
|
42
|
+
"@types/node": "24.10.1",
|
|
43
|
+
"@types/react": "18.3.28",
|
|
44
|
+
"@types/react-dom": "18.3.7",
|
|
45
|
+
"@vitejs/plugin-react": "6.0.1",
|
|
46
|
+
"jsdom": "29.0.2",
|
|
47
|
+
"react": "18.3.1",
|
|
48
|
+
"react-dom": "18.3.1",
|
|
49
|
+
"tsdown": "0.22.1",
|
|
50
|
+
"unrun": "0.3.0",
|
|
51
|
+
"vite": "8.0.10",
|
|
52
|
+
"vitest": "4.1.5",
|
|
53
|
+
"zod": "^4.6.7"
|
|
54
|
+
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"react": ">=18",
|
|
57
|
+
"react-dom": ">=18"
|
|
58
|
+
},
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": "^20.19.0 || >=22.12.0"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "tsdown",
|
|
64
|
+
"typecheck": "tsc --noEmit",
|
|
65
|
+
"test": "vitest run",
|
|
66
|
+
"test:watch": "vitest"
|
|
8
67
|
}
|
|
9
68
|
}
|