@g9tm/lynxcontrols-projects 2.5.9 → 2.5.10

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 +2090 -18
  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 +264 -0
  17. package/dist/files.css.map +1 -0
  18. package/dist/files.d.ts +86 -0
  19. package/dist/files.d.ts.map +1 -0
  20. package/dist/files.jsx +318 -0
  21. package/dist/forms.css +144 -0
  22. package/dist/forms.css.map +1 -0
  23. package/dist/forms.d.ts +89 -0
  24. package/dist/forms.d.ts.map +1 -0
  25. package/dist/forms.jsx +359 -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 +49 -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 +28 -0
  40. package/dist/timeline.d.ts.map +1 -1
  41. package/dist/timeline.jsx +150 -14
  42. package/package.json +3 -3
package/dist/forms.jsx ADDED
@@ -0,0 +1,359 @@
1
+ import { g9IdProps } from "@g9tm/lynxcontrols/base";
2
+ import { G9Button, G9IconButton } from "@g9tm/lynxcontrols/button";
3
+ import { G9Editor, G9NumberEntry, G9TextEntry } from "@g9tm/lynxcontrols/fields";
4
+ import { G9DragList } from "@g9tm/lynxcontrols/list";
5
+ import { G9DateTimePicker, G9Picker } from "@g9tm/lynxcontrols/pickers";
6
+ import { G9Menu } from "@g9tm/lynxcontrols/popover";
7
+ import { useG9Direction } from "@g9tm/lynxcontrols/provider";
8
+ import { G9ScaleInput } from "@g9tm/lynxcontrols/survey";
9
+ import { G9CheckBox, G9RadioGroup, G9RatingInput, G9Switch } from "@g9tm/lynxcontrols/toggle";
10
+ import { useState } from "@lynx-js/react";
11
+ import "./forms.css";
12
+ const g9ChoiceKinds = [
13
+ 'single',
14
+ 'multi',
15
+ 'dropdown'
16
+ ];
17
+ function g9AnswerEmpty(answer) {
18
+ if (null == answer) return true;
19
+ if ('string' == typeof answer) return 0 === answer.trim().length;
20
+ if (Array.isArray(answer)) return 0 === answer.length;
21
+ return false;
22
+ }
23
+ function G9QuestionField(props) {
24
+ var _props_words, _q_options, _w_required;
25
+ const rtl = 'rtl' === useG9Direction();
26
+ const q = props.question;
27
+ const v = props.value;
28
+ const w = null != (_props_words = props.words) ? _props_words : {};
29
+ const align = {
30
+ textAlign: rtl ? 'right' : 'left'
31
+ };
32
+ const id = (part)=>props.id ? {
33
+ id: `${props.id}_${part}`
34
+ } : {};
35
+ const options = null != (_q_options = q.options) ? _q_options : [];
36
+ const text1 = 'string' == typeof v ? v : '';
37
+ const chosen = Array.isArray(v) && (0 === v.length || 'string' == typeof v[0]) ? v : [];
38
+ const num = 'number' == typeof v ? v : null;
39
+ const date = v && 'object' == typeof v && !Array.isArray(v) && 'year' in v ? v : null;
40
+ const files = Array.isArray(v) && v.length > 0 && 'object' == typeof v[0] ? v : [];
41
+ const field = ()=>{
42
+ switch(q.kind){
43
+ case 'longText':
44
+ return <G9Editor {...id('Field')} value={text1} {...q.placeholder ? {
45
+ placeholder: q.placeholder
46
+ } : {}} onValueChange={(s)=>props.onChange(s)} {...props.problem ? {
47
+ hasError: true
48
+ } : {}} {...props.disabled ? {
49
+ disabled: true
50
+ } : {}}/>;
51
+ case 'single':
52
+ var _chosen_;
53
+ return <G9RadioGroup {...id('Field')} value={null != (_chosen_ = chosen[0]) ? _chosen_ : null} options={options.map((o)=>({
54
+ key: o.id,
55
+ label: o.label
56
+ }))} onChange={(k)=>props.onChange([
57
+ k
58
+ ])} {...props.disabled ? {
59
+ disabled: true
60
+ } : {}}/>;
61
+ case 'multi':
62
+ return <view className="g9-q__checks">
63
+ {options.map((o)=><G9CheckBox key={o.id} {...id(`Option_${o.id}`)} text={o.label} checked={chosen.includes(o.id)} onCheckedChange={(on)=>props.onChange(on ? [
64
+ ...chosen.filter((x)=>x !== o.id),
65
+ o.id
66
+ ] : chosen.filter((x)=>x !== o.id))} {...props.disabled ? {
67
+ disabled: true
68
+ } : {}}/>)}
69
+ </view>;
70
+ case 'dropdown':
71
+ var _chosen_1;
72
+ return <G9Picker {...id('Field')} {...w.choose ? {
73
+ placeholder: w.choose
74
+ } : {}} items={options.map((o)=>({
75
+ key: o.id,
76
+ text: o.label
77
+ }))} value={null != (_chosen_1 = chosen[0]) ? _chosen_1 : null} onValueChange={(k)=>props.onChange(k ? [
78
+ k
79
+ ] : [])} {...props.problem ? {
80
+ hasError: true
81
+ } : {}} {...props.disabled ? {
82
+ disabled: true
83
+ } : {}}/>;
84
+ case 'rating':
85
+ var _q_max;
86
+ return <G9RatingInput {...id('Field')} value={null != num ? num : 0} max={null != (_q_max = q.max) ? _q_max : 5} onChange={(n)=>props.onChange(n)} {...props.disabled ? {
87
+ readOnly: true
88
+ } : {}}/>;
89
+ case 'scale':
90
+ var _q_min, _q_max1;
91
+ return <G9ScaleInput {...id('Field')} min={null != (_q_min = q.min) ? _q_min : 0} max={null != (_q_max1 = q.max) ? _q_max1 : 10} value={num} onChange={(n)=>props.onChange(n)} {...q.endLabels ? {
92
+ endLabels: q.endLabels
93
+ } : {}}/>;
94
+ case 'date':
95
+ return <G9DateTimePicker {...id('Field')} mode="date" value={date ? {
96
+ ...date,
97
+ hour: 0,
98
+ minute: 0,
99
+ second: 0,
100
+ millisecond: 0
101
+ } : null} onValueChange={(d)=>props.onChange(d ? {
102
+ year: d.year,
103
+ month: d.month,
104
+ day: d.day
105
+ } : null)} {...props.problem ? {
106
+ hasError: true
107
+ } : {}} {...props.disabled ? {
108
+ disabled: true
109
+ } : {}}/>;
110
+ case 'number':
111
+ return <G9NumberEntry {...id('Field')} value={num} {...void 0 !== q.min ? {
112
+ min: q.min
113
+ } : {}} {...void 0 !== q.max ? {
114
+ max: q.max
115
+ } : {}} {...q.placeholder ? {
116
+ placeholder: q.placeholder
117
+ } : {}} onValueChange={(n)=>props.onChange(n)} {...props.problem ? {
118
+ hasError: true
119
+ } : {}} {...props.disabled ? {
120
+ disabled: true
121
+ } : {}}/>;
122
+ case 'file':
123
+ var _w_addFile;
124
+ return <view className="g9-q__files">
125
+ {files.map((f)=>{
126
+ var _w_remove;
127
+ return <view key={f.id} className="g9-q__file" style={{
128
+ flexDirection: rtl ? 'row-reverse' : 'row',
129
+ direction: 'ltr'
130
+ }}>
131
+ <text className="g9-q__file-name" text-maxline="1" style={align}>
132
+ {f.name}
133
+ </text>
134
+ {void 0 !== f.progress && f.progress < 1 ? <text className="g9-q__file-progress">{`${Math.round(100 * f.progress)}%`}</text> : null}
135
+ {props.onRemoveFile && !props.disabled ? <G9IconButton {...id(`File_${f.id}_Remove`)} icon="close" isGhost size="sm" accessibilityText={null != (_w_remove = w.remove) ? _w_remove : '×'} onPress={()=>{
136
+ var _props_onRemoveFile;
137
+ return null == (_props_onRemoveFile = props.onRemoveFile) ? void 0 : _props_onRemoveFile.call(props, f.id);
138
+ }}/> : null}
139
+ </view>;
140
+ })}
141
+ {props.onPickFiles && !props.disabled ? <G9Button {...id('AddFile')} text={null != (_w_addFile = w.addFile) ? _w_addFile : '+'} variant="tonal" size="small" onPress={()=>{
142
+ var _props_onPickFiles;
143
+ return null == (_props_onPickFiles = props.onPickFiles) ? void 0 : _props_onPickFiles.call(props);
144
+ }}/> : null}
145
+ </view>;
146
+ default:
147
+ return <G9TextEntry {...id('Field')} value={text1} {...q.placeholder ? {
148
+ placeholder: q.placeholder
149
+ } : {}} onValueChange={(s)=>props.onChange(s)} {...props.problem ? {
150
+ hasError: true
151
+ } : {}} {...props.disabled ? {
152
+ disabled: true
153
+ } : {}}/>;
154
+ }
155
+ };
156
+ return <view className="g9-q" {...g9IdProps(props.id)}>
157
+ <text className="g9-q__title" style={align}>
158
+ {q.title}
159
+ {q.required ? <text className="g9-q__required" accessibility-label={null != (_w_required = w.required) ? _w_required : '*'}>
160
+ {' *'}
161
+ </text> : null}
162
+ </text>
163
+ {q.help ? <text className="g9-q__help" style={align}>
164
+ {q.help}
165
+ </text> : null}
166
+ {field()}
167
+ {props.problem ? <text className="g9-q__problem" style={align}>
168
+ {props.problem}
169
+ </text> : null}
170
+ </view>;
171
+ }
172
+ const ALL_KINDS = [
173
+ 'text',
174
+ 'longText',
175
+ 'single',
176
+ 'multi',
177
+ 'dropdown',
178
+ 'rating',
179
+ 'scale',
180
+ 'date',
181
+ 'number',
182
+ 'file'
183
+ ];
184
+ let nextQuestion = 0;
185
+ function G9FormBuilder(props) {
186
+ var _props_newId, _props_kinds, _props_rowHeight;
187
+ const rtl = 'rtl' === useG9Direction();
188
+ const w = props.words;
189
+ const [kindMenu, setKindMenu] = useState(null);
190
+ const [addMenu, setAddMenu] = useState(false);
191
+ const newId = null != (_props_newId = props.newId) ? _props_newId : ()=>`q${++nextQuestion}`;
192
+ const kinds = null != (_props_kinds = props.kinds) ? _props_kinds : ALL_KINDS;
193
+ const row = {
194
+ flexDirection: rtl ? 'row-reverse' : 'row',
195
+ direction: 'ltr'
196
+ };
197
+ const id = (part)=>props.id ? `${props.id}_${part}` : void 0;
198
+ const set = (qid, patch)=>props.onChange(props.questions.map((q)=>q.id === qid ? {
199
+ ...q,
200
+ ...patch
201
+ } : q));
202
+ const withKind = (q, kind)=>{
203
+ var _q_options;
204
+ const next = {
205
+ ...q,
206
+ kind
207
+ };
208
+ if (g9ChoiceKinds.includes(kind) && !(null != (_q_options = q.options) ? _q_options : []).length) return {
209
+ ...next,
210
+ options: [
211
+ {
212
+ id: newId(),
213
+ label: ''
214
+ },
215
+ {
216
+ id: newId(),
217
+ label: ''
218
+ }
219
+ ]
220
+ };
221
+ return next;
222
+ };
223
+ const menuItems = kinds.map((k)=>({
224
+ key: k,
225
+ label: w.kinds[k]
226
+ }));
227
+ return <view className="g9-fb" {...g9IdProps(props.id)}>
228
+ {0 === props.questions.length && w.empty ? <text className="g9-fb__empty">{w.empty}</text> : null}
229
+ <G9DragList {...id('List') ? {
230
+ id: id('List')
231
+ } : {}} items={props.questions} getKey={(q)=>q.id} rowHeight={null != (_props_rowHeight = props.rowHeight) ? _props_rowHeight : 220} handle {...w.drag ? {
232
+ handleLabel: w.drag
233
+ } : {}} onReorder={(items)=>props.onChange(items)} renderItem={(q, dragging, controls)=>{
234
+ var _q_help, _q_options;
235
+ return <view className={`g9-fb__card${dragging ? ' g9-fb__card--dragging' : ''}`} {...g9IdProps(id(q.id))}>
236
+ <view className="g9-fb__head" style={row}>
237
+ {controls.handle}
238
+ <view className="g9-fb__kind" {...g9IdProps(id(`${q.id}_Kind`))}>
239
+ <G9Button text={w.kinds[q.kind]} variant="tonal" size="small" onPress={()=>setKindMenu(q.id)}/>
240
+ </view>
241
+ <view className="g9-fb__spacer"/>
242
+ {w.duplicate ? <G9IconButton {...id(`${q.id}_Duplicate`) ? {
243
+ id: id(`${q.id}_Duplicate`)
244
+ } : {}} icon="plus" isGhost size="sm" accessibilityText={w.duplicate} onPress={()=>{
245
+ const i = props.questions.findIndex((x)=>x.id === q.id);
246
+ const copy = {
247
+ ...q,
248
+ id: newId(),
249
+ ...q.options ? {
250
+ options: q.options.map((o)=>({
251
+ ...o,
252
+ id: newId()
253
+ }))
254
+ } : {}
255
+ };
256
+ props.onChange([
257
+ ...props.questions.slice(0, i + 1),
258
+ copy,
259
+ ...props.questions.slice(i + 1)
260
+ ]);
261
+ }}/> : null}
262
+ <G9IconButton {...id(`${q.id}_Remove`) ? {
263
+ id: id(`${q.id}_Remove`)
264
+ } : {}} icon="delete" isGhost size="sm" accessibilityText={w.remove} onPress={()=>props.onChange(props.questions.filter((x)=>x.id !== q.id))}/>
265
+ </view>
266
+ <G9TextEntry {...id(`${q.id}_Title`) ? {
267
+ id: id(`${q.id}_Title`)
268
+ } : {}} label={w.title} value={q.title} onValueChange={(t)=>set(q.id, {
269
+ title: t
270
+ })}/>
271
+ <G9TextEntry {...id(`${q.id}_Help`) ? {
272
+ id: id(`${q.id}_Help`)
273
+ } : {}} label={w.help} value={null != (_q_help = q.help) ? _q_help : ''} onValueChange={(t)=>set(q.id, {
274
+ help: t
275
+ })}/>
276
+ {g9ChoiceKinds.includes(q.kind) ? <view className="g9-fb__options">
277
+ {(null != (_q_options = q.options) ? _q_options : []).map((o, i)=>{
278
+ var _q_options;
279
+ return <view key={o.id} className="g9-fb__option" style={row}>
280
+ <view className="g9-fb__option-field">
281
+ <G9TextEntry {...id(`${q.id}_Option${i}`) ? {
282
+ id: id(`${q.id}_Option${i}`)
283
+ } : {}} placeholder={w.option(i + 1)} value={o.label} onValueChange={(t)=>{
284
+ var _q_options;
285
+ return set(q.id, {
286
+ options: (null != (_q_options = q.options) ? _q_options : []).map((x)=>x.id === o.id ? {
287
+ ...x,
288
+ label: t
289
+ } : x)
290
+ });
291
+ }}/>
292
+ </view>
293
+ {(null != (_q_options = q.options) ? _q_options : []).length > 1 ? <G9IconButton {...id(`${q.id}_Option${i}_Remove`) ? {
294
+ id: id(`${q.id}_Option${i}_Remove`)
295
+ } : {}} icon="close" isGhost size="sm" accessibilityText={w.remove} onPress={()=>{
296
+ var _q_options;
297
+ return set(q.id, {
298
+ options: (null != (_q_options = q.options) ? _q_options : []).filter((x)=>x.id !== o.id)
299
+ });
300
+ }}/> : null}
301
+ </view>;
302
+ })}
303
+ <G9Button {...id(`${q.id}_AddOption`) ? {
304
+ id: id(`${q.id}_AddOption`)
305
+ } : {}} text={`+ ${w.addOption}`} variant="ghost" size="small" onPress={()=>{
306
+ var _q_options;
307
+ return set(q.id, {
308
+ options: [
309
+ ...null != (_q_options = q.options) ? _q_options : [],
310
+ {
311
+ id: newId(),
312
+ label: ''
313
+ }
314
+ ]
315
+ });
316
+ }}/>
317
+ </view> : null}
318
+ <view className="g9-fb__required" style={row}>
319
+ <text className="g9-fb__required-text">{w.required}</text>
320
+ <G9Switch {...id(`${q.id}_Required`) ? {
321
+ id: id(`${q.id}_Required`)
322
+ } : {}} checked={true === q.required} onCheckedChange={(on)=>set(q.id, {
323
+ required: on
324
+ })}/>
325
+ </view>
326
+ </view>;
327
+ }}/>
328
+ <view className="g9-fb__add" {...g9IdProps(id('AddAnchor'))}>
329
+ <G9Button {...id('Add') ? {
330
+ id: id('Add')
331
+ } : {}} text={`+ ${w.addQuestion}`} variant="outline" onPress={()=>setAddMenu(true)}/>
332
+ </view>
333
+ <G9Menu open={null !== kindMenu} onClose={()=>setKindMenu(null)} items={menuItems.map((m)=>{
334
+ var _props_questions_find;
335
+ return {
336
+ ...m,
337
+ checked: (null == (_props_questions_find = props.questions.find((q)=>q.id === kindMenu)) ? void 0 : _props_questions_find.kind) === m.key
338
+ };
339
+ })} {...props.id && kindMenu ? {
340
+ id: `${props.id}_KindMenu`,
341
+ anchorId: `${props.id}_${kindMenu}_Kind`
342
+ } : {}} onSelect={(k)=>{
343
+ const q = props.questions.find((x)=>x.id === kindMenu);
344
+ if (q) props.onChange(props.questions.map((x)=>x.id === q.id ? withKind(q, k) : x));
345
+ }}/>
346
+ <G9Menu open={addMenu} onClose={()=>setAddMenu(false)} items={menuItems} {...props.id ? {
347
+ id: `${props.id}_AddMenu`,
348
+ anchorId: `${props.id}_AddAnchor`
349
+ } : {}} onSelect={(k)=>props.onChange([
350
+ ...props.questions,
351
+ withKind({
352
+ id: newId(),
353
+ kind: 'text',
354
+ title: ''
355
+ }, k)
356
+ ])}/>
357
+ </view>;
358
+ }
359
+ export { G9FormBuilder, G9QuestionField, g9AnswerEmpty, g9ChoiceKinds };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,9 @@
1
+ export * from './activity.js';
1
2
  export { G9Board, type G9BoardCardState, type G9BoardColumn, type G9BoardProps, } from './board.js';
3
+ export * from './files.js';
4
+ export * from './forms.js';
2
5
  export * from './model.js';
6
+ export * from './org-chart.js';
3
7
  export { G9RuleBuilder, type G9RuleBuilderLabels, type G9RuleBuilderProps, type G9RuleKind, } from './rule-builder.js';
4
8
  export { type G9DueTone, G9TaskCard, type G9TaskCardProps, type G9TaskPerson, type G9TaskPriority, } from './task-card.js';
5
9
  export { G9Timeline, type G9TimelineProps, type G9TimelineRow } from './timeline.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,SAAS,CAAC;AACjB,cAAc,SAAS,CAAC;AACxB,OAAO,EACL,aAAa,EACb,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,UAAU,GAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,SAAS,EACd,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,cAAc,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,OAAO,EACL,OAAO,EACP,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,SAAS,CAAC;AACjB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,OAAO,EACL,aAAa,EACb,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,UAAU,GAChB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,SAAS,EACd,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,cAAc,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.jsx CHANGED
@@ -1,4 +1,8 @@
1
+ export * from "./activity.jsx";
2
+ export * from "./files.jsx";
3
+ export * from "./forms.jsx";
1
4
  export * from "./model.jsx";
5
+ export * from "./org-chart.jsx";
2
6
  export { G9Board } from "./board.jsx";
3
7
  export { G9RuleBuilder } from "./rule-builder.jsx";
4
8
  export { G9TaskCard } from "./task-card.jsx";
@@ -0,0 +1,127 @@
1
+ .g9-org {
2
+ flex-direction: column;
3
+ display: flex;
4
+ }
5
+
6
+ .g9-org__search {
7
+ padding: 8px 12px;
8
+ }
9
+
10
+ .g9-org__empty {
11
+ font-size: 13px;
12
+ font-family: var(--g9-font-text);
13
+ text-align: center;
14
+ color: var(--g9-text-secondary);
15
+ padding: 24px;
16
+ }
17
+
18
+ .g9-org__row {
19
+ border-bottom-style: solid;
20
+ border-bottom-width: 1px;
21
+ border-bottom-color: var(--g9-outline-variant);
22
+ align-items: center;
23
+ column-gap: 10px;
24
+ min-height: 56px;
25
+ padding: 6px 12px;
26
+ display: flex;
27
+ }
28
+
29
+ .g9-org__row--focused {
30
+ background-color: var(--g9-primary-container);
31
+ }
32
+
33
+ .g9-org__name--hit {
34
+ color: var(--g9-primary);
35
+ }
36
+
37
+ .g9-org__texts {
38
+ flex-direction: column;
39
+ flex: 1;
40
+ min-width: 0;
41
+ display: flex;
42
+ }
43
+
44
+ .g9-org__name {
45
+ font-size: 14px;
46
+ font-weight: 600;
47
+ font-family: var(--g9-font-text-600);
48
+ color: var(--g9-text-primary);
49
+ }
50
+
51
+ .g9-org__title {
52
+ font-size: 12px;
53
+ font-family: var(--g9-font-text);
54
+ color: var(--g9-text-secondary);
55
+ }
56
+
57
+ .g9-org__count {
58
+ font-size: 11px;
59
+ font-family: var(--g9-font-text);
60
+ color: var(--g9-text-tertiary);
61
+ }
62
+
63
+ .g9-org__toggle {
64
+ border-radius: 14px;
65
+ justify-content: center;
66
+ align-items: center;
67
+ width: 28px;
68
+ height: 28px;
69
+ display: flex;
70
+ }
71
+
72
+ .g9-org__bar {
73
+ align-items: center;
74
+ column-gap: 4px;
75
+ display: flex;
76
+ }
77
+
78
+ .g9-org__bar-search {
79
+ flex: 1;
80
+ min-width: 0;
81
+ }
82
+
83
+ .g9-org__frame {
84
+ position: relative;
85
+ }
86
+
87
+ .g9-org__canvas {
88
+ position: absolute;
89
+ top: 0;
90
+ }
91
+
92
+ .g9-org__line {
93
+ position: absolute;
94
+ }
95
+
96
+ .g9-org__card {
97
+ border-style: solid;
98
+ border-width: 1px;
99
+ border-color: var(--g9-outline-variant);
100
+ background-color: var(--g9-surface-container);
101
+ border-radius: 12px;
102
+ align-items: center;
103
+ column-gap: 8px;
104
+ padding: 0 10px;
105
+ display: flex;
106
+ position: absolute;
107
+ }
108
+
109
+ .g9-org__card--focused {
110
+ border-width: 2px;
111
+ border-color: var(--g9-primary);
112
+ }
113
+
114
+ .g9-org__card--hit {
115
+ border-color: var(--g9-primary);
116
+ }
117
+
118
+ .g9-org__card-foot {
119
+ flex-direction: row;
120
+ align-items: center;
121
+ display: flex;
122
+ position: absolute;
123
+ bottom: 2px;
124
+ }
125
+
126
+
127
+ /*# sourceMappingURL=org-chart.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["webpack://./src/org-chart.css"],"names":[],"mappings":"AACA;EAAE,sBAAsB;EACtB,aAAa;AACf;;AAGA;EAAE,iBAAiB;AACnB;;AAGA;EAAE,eAAe;EACf,gCAAgC;EAChC,kBAAkB;EAClB,+BAA+B;EAC/B,aAAa;AACf;;AAGA;EAAE,0BAA0B;EAC1B,wBAAwB;EACxB,8CAA8C;EAC9C,mBAAmB;EACnB,gBAAgB;EAChB,gBAAgB;EAChB,iBAAiB;EACjB,aAAa;AACf;;AAMA;EAHE,6CAA6C;AAC/C;;AAMA;EAHE,wBAAwB;AAC1B;;AAMA;EAHE,sBAAsB;EACtB,OAAO;EACP,YAAY;EACZ,aAAa;AACf;;AAMA;EAHE,eAAe;EACf,gBAAgB;EAChB,oCAAoC;EACpC,6BAA6B;AAC/B;;AAMA;EAHE,eAAe;EACf,gCAAgC;EAChC,+BAA+B;AACjC;;AAMA;EAHE,eAAe;EACf,gCAAgC;EAChC,8BAA8B;AAChC;;AAMA;EAHE,mBAAmB;EACnB,uBAAuB;EACvB,mBAAmB;EACnB,WAAW;EACX,YAAY;EACZ,aAAa;AACf;;AAMA;EAHE,mBAAmB;EACnB,eAAe;EACf,aAAa;AACf;;AAMA;EAHE,OAAO;EACP,YAAY;AACd;;AAMA;EAHE,kBAAkB;AACpB;;AAMA;EAHE,kBAAkB;EAClB,MAAM;AACR;;AAMA;EAHE,kBAAkB;AACpB;;AAMA;EAHE,mBAAmB;EACnB,iBAAiB;EACjB,uCAAuC;EACvC,6CAA6C;EAC7C,mBAAmB;EACnB,mBAAmB;EACnB,eAAe;EACf,eAAe;EACf,aAAa;EACb,kBAAkB;AACpB;;AAMA;EAHE,iBAAiB;EACjB,+BAA+B;AACjC;;AAMA;EAHE,+BAA+B;AACjC;;AAMA;EAHE,mBAAmB;EACnB,mBAAmB;EACnB,aAAa;EACb,kBAAkB;EAClB,WAAW;AACb","sourcesContent":["/* G9OrgChart (2.5.10). */\n.g9-org {\n display: flex;\n flex-direction: column;\n}\n\n.g9-org__search {\n padding: 8px 12px;\n}\n\n.g9-org__empty {\n padding: 24px;\n font-size: 13px;\n font-family: var(--g9-font-text);\n text-align: center;\n color: var(--g9-text-secondary);\n}\n\n.g9-org__row {\n display: flex;\n align-items: center;\n column-gap: 10px;\n min-height: 56px;\n padding-top: 6px;\n padding-bottom: 6px;\n padding-right: 12px;\n padding-left: 12px;\n border-bottom-width: 1px;\n border-bottom-style: solid;\n border-bottom-color: var(--g9-outline-variant);\n}\n\n.g9-org__row--focused {\n background-color: var(--g9-primary-container);\n}\n\n.g9-org__name--hit {\n color: var(--g9-primary);\n}\n\n.g9-org__texts {\n display: flex;\n flex: 1;\n min-width: 0px;\n flex-direction: column;\n}\n\n.g9-org__name {\n font-size: 14px;\n font-weight: 600;\n font-family: var(--g9-font-text-600);\n color: var(--g9-text-primary);\n}\n\n.g9-org__title {\n font-size: 12px;\n font-family: var(--g9-font-text);\n color: var(--g9-text-secondary);\n}\n\n.g9-org__count {\n font-size: 11px;\n font-family: var(--g9-font-text);\n color: var(--g9-text-tertiary);\n}\n\n.g9-org__toggle {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border-radius: 14px;\n}\n\n.g9-org__bar {\n display: flex;\n align-items: center;\n column-gap: 4px;\n}\n\n.g9-org__bar-search {\n flex: 1;\n min-width: 0px;\n}\n\n.g9-org__frame {\n position: relative;\n}\n\n.g9-org__canvas {\n position: absolute;\n top: 0px;\n}\n\n.g9-org__line {\n position: absolute;\n}\n\n.g9-org__card {\n position: absolute;\n display: flex;\n align-items: center;\n column-gap: 8px;\n padding: 0px 10px;\n border-radius: 12px;\n border-width: 1px;\n border-style: solid;\n border-color: var(--g9-outline-variant);\n background-color: var(--g9-surface-container);\n}\n\n.g9-org__card--focused {\n border-width: 2px;\n border-color: var(--g9-primary);\n}\n\n.g9-org__card--hit {\n border-color: var(--g9-primary);\n}\n\n.g9-org__card-foot {\n position: absolute;\n bottom: 2px;\n display: flex;\n flex-direction: row;\n align-items: center;\n}\n"],"sourceRoot":""}
@@ -0,0 +1,73 @@
1
+ import { type ReactNode } from '@lynx-js/react';
2
+ import './org-chart.css';
3
+ /** A person in the organisation. */
4
+ export interface G9OrgPerson {
5
+ readonly id: string;
6
+ readonly name: string;
7
+ /** The job title. */
8
+ readonly title?: string;
9
+ /** Their manager's id (none, or an unknown id: a top of the tree). */
10
+ readonly managerId?: string | null;
11
+ readonly avatar?: string | null;
12
+ readonly presence?: 'online' | 'busy' | 'away' | 'offline';
13
+ }
14
+ /** The tree of a list of people: the tops, each one's reports and manager (a loop is cut where it closes). */
15
+ export interface G9OrgTree {
16
+ readonly roots: readonly string[];
17
+ readonly children: ReadonlyMap<string, readonly string[]>;
18
+ readonly parent: ReadonlyMap<string, string>;
19
+ readonly byId: ReadonlyMap<string, G9OrgPerson>;
20
+ }
21
+ /** Builds the tree from the people's managers, in the list's order. */
22
+ export declare function g9OrgTree(people: readonly G9OrgPerson[]): G9OrgTree;
23
+ /** Everyone under a person (all levels). */
24
+ export declare function g9OrgReportCount(tree: G9OrgTree, id: string): number;
25
+ /** A card's place on the canvas (logical: left to right). */
26
+ export interface G9OrgBox {
27
+ readonly id: string;
28
+ readonly x: number;
29
+ readonly y: number;
30
+ readonly depth: number;
31
+ }
32
+ /** The tree laid out: leaves side by side, each manager centred over their reports; collapsed branches left out. */
33
+ export declare function g9OrgLayout(tree: G9OrgTree, collapsed: ReadonlySet<string>, size: {
34
+ readonly width: number;
35
+ readonly height: number;
36
+ readonly gapX: number;
37
+ readonly gapY: number;
38
+ }, visible?: ReadonlySet<string> | null): {
39
+ readonly boxes: readonly G9OrgBox[];
40
+ readonly width: number;
41
+ readonly height: number;
42
+ };
43
+ /** The people a search shows: the matches and their managers up to the top. */
44
+ export declare function g9OrgMatches(tree: G9OrgTree, query: string): ReadonlySet<string> | null;
45
+ /** Props of {@link G9OrgChart}. */
46
+ export interface G9OrgChartProps {
47
+ readonly id?: string;
48
+ readonly people: readonly G9OrgPerson[];
49
+ /** `'auto'` (default): the tree on a wide window, the list on a phone. */
50
+ readonly layout?: 'auto' | 'tree' | 'list';
51
+ /** A person ringed, their managers opened. */
52
+ readonly focusId?: string | null;
53
+ readonly onOpen?: (id: string) => void;
54
+ /** Levels open at first (default 2). */
55
+ readonly initialDepth?: number;
56
+ /** The search text (the app's), or a search field with `searchPlaceholder`. */
57
+ readonly query?: string;
58
+ readonly searchPlaceholder?: string;
59
+ /** The tree's height (dp) on a wide window. Default 480. */
60
+ readonly height?: number;
61
+ readonly words?: {
62
+ /** «4 reports». */
63
+ readonly reports?: (count: number) => string;
64
+ readonly expand?: string;
65
+ readonly collapse?: string;
66
+ readonly zoomIn?: string;
67
+ readonly zoomOut?: string;
68
+ readonly empty?: string;
69
+ };
70
+ }
71
+ /** Who reports to whom: a zoomable tree on a wide window, a nested list on a phone. */
72
+ export declare function G9OrgChart(props: G9OrgChartProps): ReactNode;
73
+ //# sourceMappingURL=org-chart.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"org-chart.d.ts","sourceRoot":"","sources":["../src/org-chart.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,SAAS,EAAgC,MAAM,gBAAgB,CAAC;AAC9E,OAAO,iBAAiB,CAAC;AAEzB,oCAAoC;AACpC,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qBAAqB;IACrB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,sEAAsE;IACtE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CAC5D;AAED,8GAA8G;AAC9G,MAAM,WAAW,SAAS;IACxB,QAAQ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