@g9tm/lynxcontrols-projects 2.5.9 → 2.5.11

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.
Files changed (42) hide show
  1. package/README.md +5 -0
  2. package/catalog/cards/G9ActivityFeed.md +17 -0
  3. package/catalog/cards/G9FileBrowser.md +17 -0
  4. package/catalog/cards/G9FormBuilder.md +15 -0
  5. package/catalog/cards/G9OrgChart.md +17 -0
  6. package/catalog/cards/G9QuestionField.md +17 -0
  7. package/catalog/cards/G9Timeline.md +3 -3
  8. package/catalog/catalog.json +2319 -13
  9. package/catalog/index.md +6 -1
  10. package/dist/.tsbuildinfo +1 -1
  11. package/dist/activity.css +105 -0
  12. package/dist/activity.css.map +1 -0
  13. package/dist/activity.d.ts +49 -0
  14. package/dist/activity.d.ts.map +1 -0
  15. package/dist/activity.jsx +129 -0
  16. package/dist/files.css +336 -0
  17. package/dist/files.css.map +1 -0
  18. package/dist/files.d.ts +123 -0
  19. package/dist/files.d.ts.map +1 -0
  20. package/dist/files.jsx +393 -0
  21. package/dist/forms.css +155 -0
  22. package/dist/forms.css.map +1 -0
  23. package/dist/forms.d.ts +94 -0
  24. package/dist/forms.d.ts.map +1 -0
  25. package/dist/forms.jsx +372 -0
  26. package/dist/index.d.ts +4 -0
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.jsx +4 -0
  29. package/dist/org-chart.css +127 -0
  30. package/dist/org-chart.css.map +1 -0
  31. package/dist/org-chart.d.ts +73 -0
  32. package/dist/org-chart.d.ts.map +1 -0
  33. package/dist/org-chart.jsx +388 -0
  34. package/dist/projects.css +66 -0
  35. package/dist/projects.css.map +1 -1
  36. package/dist/rule-builder.d.ts +6 -0
  37. package/dist/rule-builder.d.ts.map +1 -1
  38. package/dist/rule-builder.jsx +24 -3
  39. package/dist/timeline.d.ts +30 -0
  40. package/dist/timeline.d.ts.map +1 -1
  41. package/dist/timeline.jsx +158 -18
  42. package/package.json +3 -3
@@ -20,6 +20,18 @@ export interface G9TimelineRow {
20
20
  readonly dependsOn?: readonly string[];
21
21
  /** Its bar is not moved by a drag. */
22
22
  readonly locked?: boolean;
23
+ /** The task's code before the title («HUB-142»), left to right. */
24
+ readonly code?: string;
25
+ /** Who it is assigned to: an avatar in the titles column. */
26
+ readonly assignee?: {
27
+ readonly name: string;
28
+ readonly avatar?: string | null;
29
+ readonly id?: string;
30
+ } | null;
31
+ /** A short text at the end of the title («3/5» on a milestone). */
32
+ readonly meta?: string;
33
+ /** Past its day and not done: a milestone turns red (done: green). */
34
+ readonly late?: boolean;
23
35
  }
24
36
  /** Props of {@link G9Timeline}. */
25
37
  export interface G9TimelineProps {
@@ -54,6 +66,24 @@ export interface G9TimelineProps {
54
66
  readonly todayLabel?: string;
55
67
  /** How a bar is spoken (default its title). */
56
68
  readonly barLabel?: (row: G9TimelineRow) => string;
69
+ /** Scrolls to this row's bar or milestone (open on a milestone); again whenever it changes. */
70
+ readonly scrollToKey?: string | null;
71
+ /** The organisation's days off (epoch days), shaded like the weekend. */
72
+ readonly daysOff?: readonly number[];
73
+ /**
74
+ * The keyboard edits the focused bar (default on with `onSpanChange`): ←/→ move it, Shift+←/→ the due date, Alt+←/→
75
+ * the start, ↑/↓ the row; saved after a pause.
76
+ */
77
+ readonly keyboard?: boolean;
78
+ /** ↑/↓ moved the focus (without it the timeline keeps the focus itself). */
79
+ readonly onFocusChange?: (key: string) => void;
80
+ /** Said after a keyboard change (the app's announcer): `announceLabel` or the title and the days. */
81
+ readonly onAnnounce?: (text: string) => void;
82
+ readonly announceLabel?: (row: G9TimelineRow, span: G9DaySpan) => string;
83
+ /** How long the keyboard waits before saving (ms). Default 700. */
84
+ readonly keyboardSaveDelay?: number;
85
+ /** A «Today» button over the chart that scrolls to today (2.5.11): its words. */
86
+ readonly todayButton?: string;
57
87
  }
58
88
  /** A Gantt chart: rows and bars an app keeps, moved and resized on the main thread, in the culture's calendar. */
59
89
  export declare function G9Timeline(props: G9TimelineProps): ReactNode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E,8CAA8C;IAC9C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,+CAA+C;IAC/C,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,aAAa,KAAK,MAAM,CAAC;IAEnD,+FAA+F;IAC/F,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,yEAAyE;IACzE,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,4EAA4E;IAC5E,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,qGAAqG;IACrG,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,KAAK,MAAM,CAAC;IACzE,mEAAmE;IACnE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IACpC,iFAAiF;IACjF,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAwKD,kHAAkH;AAClH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,SAAS,CAka5D"}
package/dist/timeline.jsx CHANGED
@@ -1,9 +1,11 @@
1
1
  import { measureNode } from "@g9tm/lynxcontrols/anchor";
2
2
  import { g9IdProps } from "@g9tm/lynxcontrols/base";
3
+ import { useG9Keys } from "@g9tm/lynxcontrols/commands";
4
+ import { G9Avatar, avatarTone } from "@g9tm/lynxcontrols/display";
3
5
  import { useG9Culture, useG9Direction } from "@g9tm/lynxcontrols/provider";
4
6
  import { G9Segmented } from "@g9tm/lynxcontrols/toggle";
5
7
  import { fromEpochDays, g9Haptic, getMonthName, toCalendarDate, toNativeDigits } from "@g9tm/lynxcontrols-foundation";
6
- import { memo, runOnBackground, runOnMainThread, useMainThreadRef, useMemo, useRef } from "@lynx-js/react";
8
+ import { memo, runOnBackground, runOnMainThread, useEffect, useMainThreadRef, useMemo, useRef, useState } from "@lynx-js/react";
7
9
  import "./projects.css";
8
10
  import { dayToX, dragSpanMT, linkSegments, monthStarts, nextMonthStart, physicalLeft, snapDaysMT, timelineRange, timelineScale, timelineWidth, weekStarts, weekdayOf, xToDay } from "./model.jsx";
9
11
  const IDLE = {
@@ -129,7 +131,8 @@ const Bar = memo(function(props) {
129
131
  </>;
130
132
  });
131
133
  function G9Timeline(props) {
132
- var _props_zoom, _props_rowHeight, _props_labelWidth, _props_weekStartsOn, _props_weekend, _props_range, _props_todayLabel;
134
+ var _props_zoom, _props_rowHeight, _props_labelWidth, _props_weekStartsOn, _props_weekend, _props_range, _props_focusedKey, _props_keyboard, _props_daysOff, _ref, _props_todayLabel;
135
+ var _scrollTarget_span;
133
136
  const culture = useG9Culture();
134
137
  const rtl = 'rtl' === useG9Direction();
135
138
  const uid = useMemo(()=>{
@@ -169,6 +172,82 @@ function G9Timeline(props) {
169
172
  const latest = useRef(props);
170
173
  latest.current = props;
171
174
  const scrollLeft = useRef(0);
175
+ const chartNode = useRef(null);
176
+ const [ownFocus, setOwnFocus] = useState(null != (_props_focusedKey = props.focusedKey) ? _props_focusedKey : null);
177
+ useEffect(()=>{
178
+ var _props_focusedKey;
179
+ return setOwnFocus(null != (_props_focusedKey = props.focusedKey) ? _props_focusedKey : null);
180
+ }, [
181
+ props.focusedKey
182
+ ]);
183
+ const focusKey = ownFocus;
184
+ const [pending, setPending] = useState(null);
185
+ const timer = useRef(null);
186
+ const pendingRef = useRef(pending);
187
+ pendingRef.current = pending;
188
+ const flush = ()=>{
189
+ var _latest_current_onSpanChange, _latest_current;
190
+ if (timer.current) clearTimeout(timer.current);
191
+ timer.current = null;
192
+ const p = pendingRef.current;
193
+ if (!p) return;
194
+ setPending(null);
195
+ pendingRef.current = null;
196
+ null == (_latest_current_onSpanChange = (_latest_current = latest.current).onSpanChange) || _latest_current_onSpanChange.call(_latest_current, p.key, p.span);
197
+ };
198
+ useEffect(()=>()=>{
199
+ if (timer.current) clearTimeout(timer.current);
200
+ }, []);
201
+ const editable = (r)=>!!r && 'group' !== r.kind && true !== r.locked && !!r.span;
202
+ useG9Keys((e)=>{
203
+ var _latest_current_keyboardSaveDelay;
204
+ var _pendingRef_current, _latest_current_onAnnounce, _latest_current;
205
+ const rows = latest.current.rows;
206
+ const i = rows.findIndex((r)=>r.key === focusKey);
207
+ const row = rows[i];
208
+ if (!row) return false;
209
+ if ('ArrowUp' === e.key || 'ArrowDown' === e.key) {
210
+ const step = 'ArrowDown' === e.key ? 1 : -1;
211
+ for(let j = i + step; j >= 0 && j < rows.length; j += step){
212
+ var _latest_current_onFocusChange, _latest_current1;
213
+ const next = rows[j];
214
+ if ('group' !== next.kind) {
215
+ flush();
216
+ setOwnFocus(next.key);
217
+ null == (_latest_current_onFocusChange = (_latest_current1 = latest.current).onFocusChange) || _latest_current_onFocusChange.call(_latest_current1, next.key);
218
+ break;
219
+ }
220
+ }
221
+ return true;
222
+ }
223
+ if ('ArrowLeft' !== e.key && 'ArrowRight' !== e.key || !editable(row)) return false;
224
+ const base = (null == (_pendingRef_current = pendingRef.current) ? void 0 : _pendingRef_current.key) === row.key ? pendingRef.current.span : row.span;
225
+ const d = ('ArrowRight' === e.key ? 1 : -1) * (rtl ? -1 : 1);
226
+ const next = e.shift ? {
227
+ start: base.start,
228
+ end: Math.max(base.start, base.end + d)
229
+ } : e.alt ? {
230
+ start: Math.min(base.end, base.start + d),
231
+ end: base.end
232
+ } : {
233
+ start: base.start + d,
234
+ end: base.end + d
235
+ };
236
+ const now = {
237
+ key: row.key,
238
+ span: next
239
+ };
240
+ setPending(now);
241
+ pendingRef.current = now;
242
+ g9Haptic('select');
243
+ const said = latest.current.announceLabel ? latest.current.announceLabel(row, next) : `${row.title}: ${toNativeDigits(String(toCalendarDate(fromEpochDays(next.start), culture.calendar).day), culture.numberingSystem)}–${toNativeDigits(String(toCalendarDate(fromEpochDays(next.end), culture.calendar).day), culture.numberingSystem)}`;
244
+ null == (_latest_current_onAnnounce = (_latest_current = latest.current).onAnnounce) || _latest_current_onAnnounce.call(_latest_current, said);
245
+ if (timer.current) clearTimeout(timer.current);
246
+ timer.current = setTimeout(flush, null != (_latest_current_keyboardSaveDelay = latest.current.keyboardSaveDelay) ? _latest_current_keyboardSaveDelay : 700);
247
+ return true;
248
+ }, {
249
+ enabled: (null != (_props_keyboard = props.keyboard) ? _props_keyboard : void 0 !== props.onSpanChange) && null !== focusKey
250
+ });
172
251
  const commit = (key, start, end)=>{
173
252
  var _latest_current_onSpanChange, _latest_current;
174
253
  g9Haptic('select');
@@ -219,8 +298,9 @@ function G9Timeline(props) {
219
298
  label: digits(toCalendarDate(fromEpochDays(d), culture.calendar).day)
220
299
  }));
221
300
  const shaded = [];
301
+ const off = new Set(null != (_props_daysOff = props.daysOff) ? _props_daysOff : []);
222
302
  if ('quarter' !== zoom) {
223
- for(let d = range.from; d <= range.to; d++)if (weekend.includes(weekdayOf(d))) shaded.push(d);
303
+ for(let d = range.from; d <= range.to; d++)if (weekend.includes(weekdayOf(d)) || off.has(d)) shaded.push(d);
224
304
  }
225
305
  const index = new Map(props.rows.map((r, i)=>[
226
306
  r.key,
@@ -237,6 +317,32 @@ function G9Timeline(props) {
237
317
  }) : []);
238
318
  const headH = 'quarter' === zoom ? 28 : 52;
239
319
  const todayX = dayToX(props.today, scale);
320
+ const scrollTarget = props.scrollToKey ? props.rows.find((r)=>r.key === props.scrollToKey) : void 0;
321
+ const targetDay = null != (_ref = null == scrollTarget ? void 0 : null == (_scrollTarget_span = scrollTarget.span) ? void 0 : _scrollTarget_span.start) ? _ref : null == scrollTarget ? void 0 : scrollTarget.day;
322
+ const scrollToDay = (day)=>{
323
+ const logical = Math.max(0, dayToX(day, scale) - 48);
324
+ const offset = rtl ? Math.max(0, width - logical - 320) : logical;
325
+ try {
326
+ var _chartNode_current;
327
+ null == (_chartNode_current = chartNode.current) || _chartNode_current.invoke({
328
+ method: 'scrollTo',
329
+ params: {
330
+ offset,
331
+ smooth: true
332
+ }
333
+ }).exec();
334
+ } catch {}
335
+ };
336
+ useEffect(()=>{
337
+ if (void 0 === targetDay) return;
338
+ scrollToDay(targetDay);
339
+ const again = setTimeout(()=>scrollToDay(targetDay), 120);
340
+ return ()=>clearTimeout(again);
341
+ }, [
342
+ props.scrollToKey,
343
+ targetDay,
344
+ zoom
345
+ ]);
240
346
  const schedule = async (row, e)=>{
241
347
  var _ref;
242
348
  var _e_detail;
@@ -248,10 +354,14 @@ function G9Timeline(props) {
248
354
  commit(row.key, day, day);
249
355
  };
250
356
  return <view className="g9-tl" {...g9IdProps(props.id)}>
251
- {props.onZoomChange ? <view className="g9-tl__zoom" style={{
252
- alignItems: rtl ? 'flex-start' : 'flex-end'
357
+ {props.onZoomChange || props.todayButton ? <view className="g9-tl__zoom" style={{
358
+ flexDirection: rtl ? 'row' : 'row-reverse',
359
+ direction: 'ltr'
253
360
  }}>
254
- <G9Segmented size="sm" fit="content" value={zoom} onChange={(z)=>{
361
+ {props.todayButton ? <view className="g9-tl__today-button" {...g9IdProps(props.id ? `${props.id}_Today` : void 0)} bindtap={()=>scrollToDay(props.today)} accessibility-element={true} accessibility-traits="button" accessibility-label={props.todayButton}>
362
+ <text className="g9-tl__today-text">{props.todayButton}</text>
363
+ </view> : null}
364
+ {props.onZoomChange ? <G9Segmented size="sm" fit="content" value={zoom} onChange={(z)=>{
255
365
  var _props_onZoomChange;
256
366
  return null == (_props_onZoomChange = props.onZoomChange) ? void 0 : _props_onZoomChange.call(props, z);
257
367
  }} items={[
@@ -265,7 +375,7 @@ function G9Timeline(props) {
265
375
  key: z,
266
376
  label: null != (_ref = null == (_props_zoomLabels = props.zoomLabels) ? void 0 : _props_zoomLabels[z]) ? _ref : z
267
377
  };
268
- })}/>
378
+ })}/> : null}
269
379
  </view> : null}
270
380
  <scroll-view className="g9-tl__vscroll" scroll-orientation="vertical">
271
381
  <view className="g9-tl__frame" style={{
@@ -278,7 +388,9 @@ function G9Timeline(props) {
278
388
  <view style={{
279
389
  height: `${headH}px`
280
390
  }}/>
281
- {props.rows.map((r)=><view key={r.key} className={`g9-tl__label${'group' === r.kind ? ' g9-tl__label--group' : ''}`} {...g9IdProps(props.id ? `${props.id}_${r.key}_Label` : void 0)} style={{
391
+ {props.rows.map((r)=>{
392
+ var _r_assignee_avatar, _r_assignee_id;
393
+ return <view key={r.key} className={`g9-tl__label${'group' === r.kind ? ' g9-tl__label--group' : ''}`} {...g9IdProps(props.id ? `${props.id}_${r.key}_Label` : void 0)} style={{
282
394
  height: `${rowH}px`
283
395
  }} {...props.onOpen && 'group' !== r.kind ? {
284
396
  bindtap: ()=>{
@@ -286,14 +398,29 @@ function G9Timeline(props) {
286
398
  return null == (_props_onOpen = props.onOpen) ? void 0 : _props_onOpen.call(props, r.key);
287
399
  }
288
400
  } : {}}>
289
- <text className={`g9-tl__label-text${r.done ? ' g9-tl__label-text--done' : ''}`} text-maxline="1" style={{
401
+ <view className="g9-tl__label-row" style={{
402
+ flexDirection: rtl ? 'row-reverse' : 'row',
403
+ direction: 'ltr'
404
+ }}>
405
+ {r.assignee ? <G9Avatar name={r.assignee.name} image={null != (_r_assignee_avatar = r.assignee.avatar) ? _r_assignee_avatar : null} size={20} tone={avatarTone(null != (_r_assignee_id = r.assignee.id) ? _r_assignee_id : r.assignee.name)}/> : null}
406
+ {r.code ? <text className="g9-tl__code g9-tl__code-mono" style={{
407
+ direction: 'ltr'
408
+ }}>
409
+ {r.code}
410
+ </text> : null}
411
+ <text className={`g9-tl__label-text${r.done ? ' g9-tl__label-text--done' : ''}`} text-maxline="1" style={{
290
412
  textAlign: rtl ? 'right' : 'left'
291
413
  }}>
292
- {r.title}
293
- </text>
294
- </view>)}
414
+ {r.title}
415
+ </text>
416
+ {r.meta ? <text className="g9-tl__meta">{r.meta}</text> : null}
417
+ </view>
418
+ </view>;
419
+ })}
295
420
  </view>
296
- <scroll-view className="g9-tl__chart" id={`${uid}__chart`} scroll-orientation="horizontal" scroll-event-throttle={100} bindscroll={(e)=>{
421
+ <scroll-view className="g9-tl__chart" id={`${uid}__chart`} ref={(r)=>{
422
+ chartNode.current = r;
423
+ }} scroll-orientation="horizontal" scroll-event-throttle={100} bindscroll={(e)=>{
297
424
  scrollLeft.current = e.detail.scrollLeft;
298
425
  }}>
299
426
  <view className="g9-tl__canvas" style={{
@@ -335,7 +462,16 @@ function G9Timeline(props) {
335
462
  if ('group' === r.kind) return <view key={r.key} className="g9-tl__row g9-tl__row--group" style={{
336
463
  top: `${top}px`,
337
464
  height: `${rowH}px`
338
- }}/>;
465
+ }}>
466
+ <text className="g9-tl__group-text" text-maxline="1" style={rtl ? {
467
+ right: '8px',
468
+ textAlign: 'right'
469
+ } : {
470
+ left: '8px'
471
+ }}>
472
+ {r.meta ? `${r.title} · ${r.meta}` : r.title}
473
+ </text>
474
+ </view>;
339
475
  if ('milestone' === r.kind && void 0 !== r.day) {
340
476
  const x = dayToX(r.day, scale) + px / 2 - 8;
341
477
  return <view key={r.key} className="g9-tl__row" style={{
@@ -345,7 +481,11 @@ function G9Timeline(props) {
345
481
  <view className="g9-tl__milestone" {...g9IdProps(props.id ? `${props.id}_${r.key}` : void 0)} style={{
346
482
  left: `${at(x, 16)}px`,
347
483
  top: `${(rowH - 16) / 2}px`,
348
- ...r.color ? {
484
+ ...r.done ? {
485
+ backgroundColor: 'var(--g9-success)'
486
+ } : r.late ? {
487
+ backgroundColor: 'var(--g9-error)'
488
+ } : r.color ? {
349
489
  backgroundColor: r.color
350
490
  } : {}
351
491
  }} {...props.onOpen ? {
@@ -353,17 +493,17 @@ function G9Timeline(props) {
353
493
  var _props_onOpen;
354
494
  return null == (_props_onOpen = props.onOpen) ? void 0 : _props_onOpen.call(props, r.key);
355
495
  }
356
- } : {}} accessibility-element={true} accessibility-label={r.title}/>
496
+ } : {}} accessibility-element={true} accessibility-label={r.meta ? `${r.title}, ${r.meta}` : r.title}/>
357
497
  </view>;
358
498
  }
359
- const span = r.span;
499
+ const span = (null == pending ? void 0 : pending.key) === r.key ? pending.span : r.span;
360
500
  return <view key={r.key} className="g9-tl__row" {...g9IdProps(props.id ? `${props.id}_${r.key}_Row` : void 0)} style={{
361
501
  top: `${top}px`,
362
502
  height: `${rowH}px`
363
503
  }} {...!span && props.onSpanChange ? {
364
504
  bindtap: (e)=>void schedule(r, e)
365
505
  } : {}}>
366
- {span ? <Bar row={r} span={span} left={at(dayToX(span.start, scale), (span.end - span.start + 1) * px)} width={(span.end - span.start + 1) * px} origin={scale.origin} px={px} chartWidth={width} rtl={rtl} focused={props.focusedKey === r.key} drag={drag} draggable={void 0 !== props.onSpanChange && true !== r.locked} label={props.barLabel ? props.barLabel(r) : r.title} {...props.onOpen ? {
506
+ {span ? <Bar row={r} span={span} left={at(dayToX(span.start, scale), (span.end - span.start + 1) * px)} width={(span.end - span.start + 1) * px} origin={scale.origin} px={px} chartWidth={width} rtl={rtl} focused={focusKey === r.key} drag={drag} draggable={void 0 !== props.onSpanChange && true !== r.locked} label={props.barLabel ? props.barLabel(r) : r.title} {...props.onOpen ? {
367
507
  onTap: props.onOpen
368
508
  } : {}} {...props.id ? {
369
509
  barId: `${props.id}_${r.key}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@g9tm/lynxcontrols-projects",
3
- "version": "2.5.9",
3
+ "version": "2.5.11",
4
4
  "description": "Project controls for G9LynxControls (G9Hub): G9Board (columns of cards dragged on the main thread), G9Timeline (a Gantt chart on the culture calendar with bars moved and resized, dependencies and milestones) and G9TaskCard.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -29,10 +29,10 @@
29
29
  "build": "rslib build"
30
30
  },
31
31
  "dependencies": {
32
- "@g9tm/lynxcontrols-foundation": "2.5.9"
32
+ "@g9tm/lynxcontrols-foundation": "2.5.11"
33
33
  },
34
34
  "peerDependencies": {
35
- "@g9tm/lynxcontrols": "2.5.9",
35
+ "@g9tm/lynxcontrols": "2.5.11",
36
36
  "@lynx-js/react": ">=0.129.3 <0.130.0"
37
37
  }
38
38
  }