@jfdevelops/react-layout 0.17.2 → 0.17.4

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.
@@ -84,24 +84,33 @@ need distinct render implementations:
84
84
 
85
85
  ```tsx
86
86
  const createCalendarPage = createResourceLayout
87
- .forResources('appointments', 'availability')
87
+ .forResources('appointments', 'availability');
88
+
89
+ const appointments = createCalendarPage.createResourceComponents({
90
+ resource: 'appointments',
91
+ props: {
92
+ defined: { segments: { title: 'Appointments' } },
93
+ },
94
+ render: function AppointmentsRender() {
95
+ return <AppointmentsView />;
96
+ },
97
+ });
98
+
99
+ const availability = createCalendarPage.createResourceComponents({
100
+ resource: 'availability',
101
+ props: {
102
+ defined: { segments: { title: 'Availability' } },
103
+ },
104
+ render: function AvailabilityRender() {
105
+ return <AvailabilityView />;
106
+ },
107
+ });
108
+
109
+ const createCalendarResourcePage = createCalendarPage
88
110
  .createComponent({
89
- props: {
90
- include: {
91
- segments: true,
92
- },
93
- },
94
111
  resources: {
95
- appointments: {
96
- render: function AppointmentsRender() {
97
- return <AppointmentsView />;
98
- },
99
- },
100
- availability: {
101
- render: function AvailabilityRender() {
102
- return <AvailabilityView />;
103
- },
104
- },
112
+ appointments,
113
+ availability,
105
114
  },
106
115
  render: function Render({ resource, children }, context) {
107
116
  return (
@@ -118,13 +127,21 @@ const createCalendarPage = createResourceLayout
118
127
  })
119
128
  .asHOF();
120
129
 
121
- export const AppointmentsPage = createCalendarPage('appointments');
122
- export const AvailabilityPage = createCalendarPage('availability');
130
+ export const AppointmentsPage = createCalendarResourcePage('appointments');
131
+ export const AvailabilityPage = createCalendarResourcePage('availability');
123
132
 
124
- <AppointmentsPage segments={{ title: 'Appointments' }} />;
125
- <AvailabilityPage segments={{ title: 'Availability' }} />;
133
+ <AppointmentsPage />;
134
+ <AppointmentsPage segments={{ title: 'Override' }} />;
135
+ <AvailabilityPage />;
126
136
  ```
127
137
 
138
+ Resource entries use one optional `props` bag: `include` exposes layout props
139
+ without defaults, `custom` declares additional props, and `defined` bakes
140
+ values into that resource. Every `defined` key is included automatically and
141
+ becomes optional at the bound call site. When a caller supplies the same prop,
142
+ the call-site value wins. Keep layout values inside `props.defined`, not beside
143
+ `render` on the entry.
144
+
128
145
  Use this pattern only when the resources share meaningful behavior, controls,
129
146
  or state transitions. The outer renderer should own behavior shared by the
130
147
  resource subset. Each resource renderer should own resource-specific data and