@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
@@ -0,0 +1,129 @@
1
+ import { g9IdProps } from "@g9tm/lynxcontrols/base";
2
+ import { G9Button } from "@g9tm/lynxcontrols/button";
3
+ import { G9ActivityIndicator, G9Avatar, avatarTone } from "@g9tm/lynxcontrols/display";
4
+ import { G9Icon } from "@g9tm/lynxcontrols/icon";
5
+ import { G9VirtualList } from "@g9tm/lynxcontrols/list";
6
+ import { useG9Culture, useG9Direction } from "@g9tm/lynxcontrols/provider";
7
+ import { formatLocalDateTime, localDateTimeFromEpochMs, toEpochDays, toNativeDigits } from "@g9tm/lynxcontrols-foundation";
8
+ import "./activity.css";
9
+ function G9ActivityFeed(props) {
10
+ var _props_utcOffsetMinutes, _props_words, _ref, _props_now, _w_empty, _props_height;
11
+ var _sorted_;
12
+ const rtl = 'rtl' === useG9Direction();
13
+ const culture = useG9Culture();
14
+ const offset = null != (_props_utcOffsetMinutes = props.utcOffsetMinutes) ? _props_utcOffsetMinutes : 0;
15
+ const w = null != (_props_words = props.words) ? _props_words : {};
16
+ const sorted = [
17
+ ...props.items
18
+ ].sort((a, b)=>b.at - a.at);
19
+ const dayOf = (ms)=>toEpochDays(localDateTimeFromEpochMs(ms, offset));
20
+ const today = dayOf(null != (_ref = null != (_props_now = props.now) ? _props_now : null == (_sorted_ = sorted[0]) ? void 0 : _sorted_.at) ? _ref : 0);
21
+ const label = (ms)=>{
22
+ const d = dayOf(ms);
23
+ if (props.dayLabel) return props.dayLabel(ms, d);
24
+ if (d === today && w.today) return w.today;
25
+ if (d === today - 1 && w.yesterday) return w.yesterday;
26
+ return formatLocalDateTime(localDateTimeFromEpochMs(ms, offset), 'dddd d MMMM', culture);
27
+ };
28
+ const time = (ms)=>{
29
+ const t = localDateTimeFromEpochMs(ms, offset);
30
+ return toNativeDigits(`${String(t.hour).padStart(2, '0')}:${String(t.minute).padStart(2, '0')}`, culture.numberingSystem);
31
+ };
32
+ const rows = [];
33
+ let day = null;
34
+ sorted.forEach((item, i)=>{
35
+ const d = dayOf(item.at);
36
+ if (d !== day) {
37
+ day = d;
38
+ rows.push({
39
+ kind: 'day',
40
+ key: `d${d}`,
41
+ label: label(item.at)
42
+ });
43
+ }
44
+ const nextDay = sorted[i + 1] ? dayOf(sorted[i + 1].at) : null;
45
+ rows.push({
46
+ kind: 'item',
47
+ key: item.id,
48
+ item,
49
+ last: nextDay !== d
50
+ });
51
+ });
52
+ if (props.onMore || props.loading) rows.push({
53
+ kind: 'more',
54
+ key: '__more'
55
+ });
56
+ const align = {
57
+ textAlign: rtl ? 'right' : 'left'
58
+ };
59
+ const id = (part)=>props.id ? `${props.id}_${part}` : void 0;
60
+ const render = (r)=>{
61
+ var _w_more, _it_actor_avatar, _it_actor_id;
62
+ if ('day' === r.kind) return <view className="g9-feed__day">
63
+ <text className="g9-feed__day-text" style={align}>
64
+ {r.label}
65
+ </text>
66
+ </view>;
67
+ if ('more' === r.kind) return <view className="g9-feed__more">
68
+ {props.loading ? <G9ActivityIndicator running={true} size={20}/> : <G9Button {...id('More') ? {
69
+ id: id('More')
70
+ } : {}} text={null != (_w_more = w.more) ? _w_more : '…'} variant="ghost" size="small" onPress={()=>{
71
+ var _props_onMore;
72
+ return null == (_props_onMore = props.onMore) ? void 0 : _props_onMore.call(props);
73
+ }}/>}
74
+ </view>;
75
+ const it = r.item;
76
+ return <view className="g9-feed__item" {...g9IdProps(id(it.id))} style={{
77
+ flexDirection: rtl ? 'row-reverse' : 'row',
78
+ direction: 'ltr'
79
+ }} {...props.onOpen ? {
80
+ bindtap: ()=>{
81
+ var _props_onOpen;
82
+ return null == (_props_onOpen = props.onOpen) ? void 0 : _props_onOpen.call(props, it);
83
+ }
84
+ } : {}} accessibility-element={true} accessibility-label={[
85
+ it.actor.name,
86
+ it.text,
87
+ it.detail,
88
+ time(it.at)
89
+ ].filter(Boolean).join(', ')}>
90
+ <view className="g9-feed__rail">
91
+ <view className={`g9-feed__stem${r.last ? ' g9-feed__stem--last' : ''}`}/>
92
+ <view className="g9-feed__node" style={it.color ? {
93
+ backgroundColor: it.color
94
+ } : {}}>
95
+ {it.icon ? <G9Icon icon={it.icon} size={12} color="var(--g9-on-primary)"/> : null}
96
+ </view>
97
+ </view>
98
+ <G9Avatar name={it.actor.name} image={null != (_it_actor_avatar = it.actor.avatar) ? _it_actor_avatar : null} size={28} tone={avatarTone(null != (_it_actor_id = it.actor.id) ? _it_actor_id : it.actor.name)}/>
99
+ <view className="g9-feed__texts">
100
+ <text className="g9-feed__text" style={{
101
+ ...align,
102
+ direction: rtl ? 'rtl' : 'ltr'
103
+ }}>
104
+ {}
105
+ <text className="g9-feed__actor">{`${rtl ? '‏' : ''}${it.actor.name} `}</text>
106
+ {it.text}
107
+ </text>
108
+ {it.detail ? <text className="g9-feed__detail" style={align}>
109
+ {it.detail}
110
+ </text> : null}
111
+ </view>
112
+ <text className="g9-feed__time">{time(it.at)}</text>
113
+ </view>;
114
+ };
115
+ if (0 === sorted.length && !props.loading) return <view className="g9-feed" {...g9IdProps(props.id)}>
116
+ <text className="g9-feed__empty">{null != (_w_empty = w.empty) ? _w_empty : ''}</text>
117
+ </view>;
118
+ if (false === props.virtual) return <view className="g9-feed" {...g9IdProps(props.id)}>
119
+ {rows.map((r)=><view key={r.key}>{render(r)}</view>)}
120
+ </view>;
121
+ return <view className="g9-feed" {...g9IdProps(props.id)} style={{
122
+ height: `${null != (_props_height = props.height) ? _props_height : 480}px`
123
+ }}>
124
+ <G9VirtualList {...id('List') ? {
125
+ id: id('List')
126
+ } : {}} items={rows} getKey={(r)=>r.key} isSticky={(r)=>'day' === r.kind} isFullSpan={(r)=>'item' !== r.kind} reuseKey={(r)=>r.kind} estimatedSize={(r)=>'day' === r.kind ? 32 : 'more' === r.kind ? 48 : 56} renderItem={render}/>
127
+ </view>;
128
+ }
129
+ export { G9ActivityFeed };
package/dist/files.css ADDED
@@ -0,0 +1,336 @@
1
+ .g9-files {
2
+ flex-direction: column;
3
+ row-gap: 8px;
4
+ display: flex;
5
+ }
6
+
7
+ .g9-files__top {
8
+ align-items: center;
9
+ column-gap: 8px;
10
+ padding: 8px 12px 0;
11
+ display: flex;
12
+ }
13
+
14
+ .g9-files__crumbs {
15
+ flex: 1;
16
+ min-width: 0;
17
+ }
18
+
19
+ .g9-files__crumb-row {
20
+ flex-wrap: wrap;
21
+ align-items: center;
22
+ display: flex;
23
+ }
24
+
25
+ .g9-files__crumb-step {
26
+ align-items: center;
27
+ display: flex;
28
+ }
29
+
30
+ .g9-files__crumb {
31
+ padding: 6px;
32
+ }
33
+
34
+ .g9-files__crumb-text {
35
+ font-size: 13px;
36
+ font-family: var(--g9-font-text);
37
+ color: var(--g9-primary);
38
+ }
39
+
40
+ .g9-files__crumb-text--here {
41
+ font-weight: 600;
42
+ font-family: var(--g9-font-text-600);
43
+ color: var(--g9-text-primary);
44
+ }
45
+
46
+ .g9-files__sort {
47
+ column-gap: 14px;
48
+ padding: 0 16px;
49
+ display: flex;
50
+ }
51
+
52
+ .g9-files__sort-key {
53
+ align-items: center;
54
+ column-gap: 2px;
55
+ padding: 4px 0;
56
+ display: flex;
57
+ }
58
+
59
+ .g9-files__sort-text {
60
+ font-size: 12px;
61
+ font-family: var(--g9-font-text);
62
+ color: var(--g9-text-secondary);
63
+ }
64
+
65
+ .g9-files__sort-text--on {
66
+ color: var(--g9-primary);
67
+ }
68
+
69
+ .g9-files__selection {
70
+ background-color: var(--g9-primary-container);
71
+ border-radius: 10px;
72
+ align-items: center;
73
+ column-gap: 8px;
74
+ margin: 0 12px;
75
+ padding: 6px 10px;
76
+ display: flex;
77
+ }
78
+
79
+ .g9-files__selection-text {
80
+ font-size: 13px;
81
+ font-weight: 600;
82
+ font-family: var(--g9-font-text-600);
83
+ color: var(--g9-on-primary-container);
84
+ flex: 1;
85
+ }
86
+
87
+ .g9-files__selection-actions {
88
+ align-items: center;
89
+ column-gap: 4px;
90
+ display: flex;
91
+ }
92
+
93
+ .g9-files__empty {
94
+ flex-direction: column;
95
+ align-items: center;
96
+ row-gap: 6px;
97
+ padding: 32px 24px;
98
+ display: flex;
99
+ }
100
+
101
+ .g9-files__empty-text {
102
+ font-size: 14px;
103
+ font-weight: 600;
104
+ font-family: var(--g9-font-text-600);
105
+ color: var(--g9-text-secondary);
106
+ }
107
+
108
+ .g9-files__empty-hint {
109
+ font-size: 12px;
110
+ font-family: var(--g9-font-text);
111
+ text-align: center;
112
+ color: var(--g9-text-tertiary);
113
+ }
114
+
115
+ .g9-files__grid {
116
+ flex-wrap: wrap;
117
+ padding: 0 8px;
118
+ display: flex;
119
+ }
120
+
121
+ .g9-files__cell {
122
+ padding: 4px;
123
+ }
124
+
125
+ .g9-files__tile {
126
+ background-color: var(--g9-surface-container);
127
+ border: 2px solid #0000;
128
+ border-radius: 12px;
129
+ flex-direction: column;
130
+ width: 100%;
131
+ display: flex;
132
+ overflow: hidden;
133
+ }
134
+
135
+ .g9-files__tile--on {
136
+ border-color: var(--g9-primary);
137
+ }
138
+
139
+ .g9-files__preview {
140
+ aspect-ratio: 4 / 3;
141
+ background-color: var(--g9-surface-container-high);
142
+ justify-content: center;
143
+ align-items: center;
144
+ display: flex;
145
+ position: relative;
146
+ }
147
+
148
+ .g9-files__thumb {
149
+ position: absolute;
150
+ top: 0;
151
+ bottom: 0;
152
+ left: 0;
153
+ right: 0;
154
+ }
155
+
156
+ .g9-files__tile-foot {
157
+ align-items: center;
158
+ column-gap: 2px;
159
+ padding: 4px 4px 4px 8px;
160
+ display: flex;
161
+ }
162
+
163
+ .g9-files__name {
164
+ min-width: 0;
165
+ font-size: 12px;
166
+ font-family: var(--g9-font-text);
167
+ color: var(--g9-text-primary);
168
+ flex: 1;
169
+ }
170
+
171
+ .g9-files__menu {
172
+ display: flex;
173
+ }
174
+
175
+ .g9-files__check {
176
+ border-style: solid;
177
+ border-width: 2px;
178
+ border-color: var(--g9-outline);
179
+ background-color: var(--g9-surface);
180
+ border-radius: 10px;
181
+ justify-content: center;
182
+ align-items: center;
183
+ width: 20px;
184
+ height: 20px;
185
+ display: flex;
186
+ position: absolute;
187
+ top: 6px;
188
+ }
189
+
190
+ .g9-files__check--on {
191
+ border-color: var(--g9-primary);
192
+ background-color: var(--g9-primary);
193
+ }
194
+
195
+ .g9-files__progress {
196
+ background-color: var(--g9-outline-variant);
197
+ height: 3px;
198
+ position: absolute;
199
+ bottom: 0;
200
+ left: 0;
201
+ right: 0;
202
+ }
203
+
204
+ .g9-files__progress-fill {
205
+ background-color: var(--g9-primary);
206
+ position: absolute;
207
+ top: 0;
208
+ bottom: 0;
209
+ }
210
+
211
+ .g9-files__list {
212
+ flex-direction: column;
213
+ display: flex;
214
+ }
215
+
216
+ .g9-files__row {
217
+ align-items: center;
218
+ column-gap: 10px;
219
+ min-height: 52px;
220
+ padding: 0 12px;
221
+ display: flex;
222
+ }
223
+
224
+ .g9-files__row--on {
225
+ background-color: var(--g9-primary-container);
226
+ }
227
+
228
+ .g9-files__check--inline {
229
+ position: relative;
230
+ top: 0;
231
+ }
232
+
233
+ .g9-files__row-icon {
234
+ background-color: var(--g9-surface-container-high);
235
+ border-radius: 8px;
236
+ justify-content: center;
237
+ align-items: center;
238
+ width: 36px;
239
+ height: 36px;
240
+ display: flex;
241
+ overflow: hidden;
242
+ }
243
+
244
+ .g9-files__row-thumb {
245
+ width: 36px;
246
+ height: 36px;
247
+ }
248
+
249
+ .g9-files__row-texts {
250
+ flex-direction: column;
251
+ flex: 1;
252
+ min-width: 0;
253
+ display: flex;
254
+ position: relative;
255
+ }
256
+
257
+ .g9-files__meta {
258
+ font-size: 11px;
259
+ font-family: var(--g9-font-text);
260
+ color: var(--g9-text-tertiary);
261
+ }
262
+
263
+ .g9-files__tile-texts {
264
+ flex-direction: column;
265
+ flex: 1;
266
+ min-width: 0;
267
+ display: flex;
268
+ }
269
+
270
+ .g9-files__tile--recent {
271
+ border-color: var(--g9-primary-container);
272
+ background-color: var(--g9-primary-container);
273
+ }
274
+
275
+ .g9-files__row--recent {
276
+ background-color: var(--g9-primary-container);
277
+ }
278
+
279
+ .g9-files__version {
280
+ background-color: var(--g9-surface-container-high);
281
+ border-radius: 9px;
282
+ align-items: center;
283
+ height: 18px;
284
+ padding: 0 6px;
285
+ display: flex;
286
+ }
287
+
288
+ .g9-files__version-text {
289
+ font-size: 10px;
290
+ font-family: var(--g9-font-text-600);
291
+ color: var(--g9-text-secondary);
292
+ }
293
+
294
+ .g9-files__play {
295
+ background-color: var(--g9-primary);
296
+ border-radius: 14px;
297
+ justify-content: center;
298
+ align-items: center;
299
+ width: 28px;
300
+ height: 28px;
301
+ display: flex;
302
+ }
303
+
304
+ .g9-files__uploads {
305
+ background-color: var(--g9-surface-container);
306
+ border-radius: 12px;
307
+ flex-direction: column;
308
+ margin: 0 12px;
309
+ display: flex;
310
+ }
311
+
312
+ .g9-files__upload {
313
+ align-items: center;
314
+ column-gap: 8px;
315
+ min-height: 48px;
316
+ padding: 0 10px;
317
+ display: flex;
318
+ }
319
+
320
+ .g9-files__upload-bar {
321
+ background-color: var(--g9-outline-variant);
322
+ border-radius: 2px;
323
+ height: 3px;
324
+ margin-top: 4px;
325
+ position: relative;
326
+ overflow: hidden;
327
+ }
328
+
329
+ .g9-files__upload-error {
330
+ font-size: 11px;
331
+ font-family: var(--g9-font-text);
332
+ color: var(--g9-error);
333
+ }
334
+
335
+
336
+ /*# sourceMappingURL=files.css.map */
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["webpack://./src/files.css"],"names":[],"mappings":"AACA;EAAE,sBAAsB;EACtB,YAAY;EACZ,aAAa;AACf;;AAGA;EAAE,mBAAmB;EACnB,eAAe;EACf,mBAAmB;EACnB,aAAa;AACf;;AAGA;EAAE,OAAO;EACP,YAAY;AACd;;AAGA;EAAE,eAAe;EACf,mBAAmB;EACnB,aAAa;AACf;;AAGA;EAAE,mBAAmB;EACnB,aAAa;AACf;;AAGA;EAAE,YAAY;AACd;;AAGA;EAAE,eAAe;EACf,gCAAgC;EAChC,wBAAwB;AAC1B;;AAGA;EAAE,gBAAgB;EAChB,oCAAoC;EACpC,6BAA6B;AAC/B;;AAGA;EAAE,g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MA;EAHE,mBAAmB;EACnB,eAAe;EACf,gBAAgB;EAChB,eAAe;EACf,aAAa;AACf;;AAMA;EAHE,2CAA2C;EAC3C,kBAAkB;EAClB,WAAW;EACX,eAAe;EACf,kBAAkB;EAClB,gBAAgB;AAClB;;AAMA;EAHE,eAAe;EACf,gCAAgC;EAChC,sBAAsB;AACxB","sourcesContent":["/* G9FileBrowser (2.5.10). */\n.g9-files {\n display: flex;\n flex-direction: column;\n row-gap: 8px;\n}\n\n.g9-files__top {\n display: flex;\n align-items: center;\n column-gap: 8px;\n padding: 8px 12px 0px 12px;\n}\n\n.g9-files__crumbs {\n flex: 1;\n min-width: 0px;\n}\n\n.g9-files__crumb-row {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n}\n\n.g9-files__crumb-step {\n display: flex;\n align-items: center;\n}\n\n.g9-files__crumb {\n padding: 6px 6px;\n}\n\n.g9-files__crumb-text {\n font-size: 13px;\n font-family: var(--g9-font-text);\n color: var(--g9-primary);\n}\n\n.g9-files__crumb-text--here {\n font-weight: 600;\n font-family: var(--g9-font-text-600);\n color: var(--g9-text-primary);\n}\n\n.g9-files__sort {\n display: flex;\n column-gap: 14px;\n padding: 0px 16px;\n}\n\n.g9-files__sort-key {\n display: flex;\n align-items: center;\n column-gap: 2px;\n padding: 4px 0px;\n}\n\n.g9-files__sort-text {\n font-size: 12px;\n font-family: var(--g9-font-text);\n color: var(--g9-text-secondary);\n}\n\n.g9-files__sort-text--on {\n color: var(--g9-primary);\n}\n\n.g9-files__selection {\n display: flex;\n align-items: center;\n column-gap: 8px;\n margin: 0px 12px;\n padding: 6px 10px;\n border-radius: 10px;\n background-color: var(--g9-primary-container);\n}\n\n.g9-files__selection-text {\n flex: 1;\n font-size: 13px;\n font-weight: 600;\n font-family: var(--g9-font-text-600);\n color: var(--g9-on-primary-container);\n}\n\n.g9-files__selection-actions {\n display: flex;\n align-items: center;\n column-gap: 4px;\n}\n\n.g9-files__empty {\n display: flex;\n flex-direction: column;\n align-items: center;\n row-gap: 6px;\n padding: 32px 24px;\n}\n\n.g9-files__empty-text {\n font-size: 14px;\n font-weight: 600;\n font-family: var(--g9-font-text-600);\n color: var(--g9-text-secondary);\n}\n\n.g9-files__empty-hint {\n font-size: 12px;\n font-family: var(--g9-font-text);\n text-align: center;\n color: var(--g9-text-tertiary);\n}\n\n.g9-files__grid {\n display: flex;\n flex-wrap: wrap;\n padding: 0px 8px;\n}\n\n.g9-files__cell {\n padding: 4px;\n}\n\n.g9-files__tile {\n width: 100%;\n display: flex;\n flex-direction: column;\n border-radius: 12px;\n overflow: hidden;\n border-width: 2px;\n border-style: solid;\n border-color: transparent;\n background-color: var(--g9-surface-container);\n}\n\n.g9-files__tile--on {\n border-color: var(--g9-primary);\n}\n\n.g9-files__preview {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n aspect-ratio: 4 / 3;\n background-color: var(--g9-surface-container-high);\n}\n\n.g9-files__thumb {\n position: absolute;\n top: 0px;\n right: 0px;\n bottom: 0px;\n left: 0px;\n}\n\n.g9-files__tile-foot {\n display: flex;\n align-items: center;\n column-gap: 2px;\n padding: 4px 4px 4px 8px;\n}\n\n.g9-files__name {\n flex: 1;\n min-width: 0px;\n font-size: 12px;\n font-family: var(--g9-font-text);\n color: var(--g9-text-primary);\n}\n\n.g9-files__menu {\n display: flex;\n}\n\n.g9-files__check {\n position: absolute;\n top: 6px;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n border-radius: 10px;\n border-width: 2px;\n border-style: solid;\n border-color: var(--g9-outline);\n background-color: var(--g9-surface);\n}\n\n.g9-files__check--on {\n border-color: var(--g9-primary);\n background-color: var(--g9-primary);\n}\n\n.g9-files__progress {\n position: absolute;\n bottom: 0px;\n left: 0px;\n right: 0px;\n height: 3px;\n background-color: var(--g9-outline-variant);\n}\n\n.g9-files__progress-fill {\n position: absolute;\n top: 0px;\n bottom: 0px;\n background-color: var(--g9-primary);\n}\n\n.g9-files__list {\n display: flex;\n flex-direction: column;\n}\n\n.g9-files__row {\n display: flex;\n align-items: center;\n column-gap: 10px;\n min-height: 52px;\n padding: 0px 12px;\n}\n\n.g9-files__row--on {\n background-color: var(--g9-primary-container);\n}\n\n.g9-files__check--inline {\n position: relative;\n top: 0px;\n}\n\n.g9-files__row-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n border-radius: 8px;\n overflow: hidden;\n background-color: var(--g9-surface-container-high);\n}\n\n.g9-files__row-thumb {\n width: 36px;\n height: 36px;\n}\n\n.g9-files__row-texts {\n position: relative;\n display: flex;\n flex: 1;\n min-width: 0px;\n flex-direction: column;\n}\n\n.g9-files__meta {\n font-size: 11px;\n font-family: var(--g9-font-text);\n color: var(--g9-text-tertiary);\n}\n\n/* Versions, recently changed, a subtitle, the upload queue, audio in place (2.5.11). */\n.g9-files__tile-texts {\n display: flex;\n flex: 1;\n min-width: 0px;\n flex-direction: column;\n}\n\n.g9-files__tile--recent {\n border-color: var(--g9-primary-container);\n background-color: var(--g9-primary-container);\n}\n\n.g9-files__row--recent {\n background-color: var(--g9-primary-container);\n}\n\n.g9-files__version {\n display: flex;\n align-items: center;\n height: 18px;\n padding: 0px 6px;\n border-radius: 9px;\n background-color: var(--g9-surface-container-high);\n}\n\n.g9-files__version-text {\n font-size: 10px;\n font-family: var(--g9-font-text-600);\n color: var(--g9-text-secondary);\n}\n\n.g9-files__play {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border-radius: 14px;\n background-color: var(--g9-primary);\n}\n\n.g9-files__uploads {\n display: flex;\n flex-direction: column;\n margin: 0px 12px;\n border-radius: 12px;\n background-color: var(--g9-surface-container);\n}\n\n.g9-files__upload {\n display: flex;\n align-items: center;\n column-gap: 8px;\n min-height: 48px;\n padding: 0px 10px;\n}\n\n.g9-files__upload-bar {\n position: relative;\n height: 3px;\n margin-top: 4px;\n border-radius: 2px;\n overflow: hidden;\n background-color: var(--g9-outline-variant);\n}\n\n.g9-files__upload-error {\n font-size: 11px;\n font-family: var(--g9-font-text);\n color: var(--g9-error);\n}\n"],"sourceRoot":""}
@@ -0,0 +1,123 @@
1
+ import { type G9MenuItem } from '@g9tm/lynxcontrols/popover';
2
+ import { type ReactNode } from '@lynx-js/react';
3
+ import './files.css';
4
+ /** What a file is (its icon). */
5
+ export type G9FileEntryKind = 'folder' | 'image' | 'video' | 'audio' | 'archive' | 'sheet' | 'doc' | 'other';
6
+ /** A file or a folder. */
7
+ export interface G9FileEntry {
8
+ readonly id: string;
9
+ readonly name: string;
10
+ /** Default from the name's extension (a folder says so). */
11
+ readonly kind?: G9FileEntryKind;
12
+ /** Bytes. */
13
+ readonly size?: number;
14
+ /** Changed (epoch ms) — shown as the app words it in `modifiedLabel`. */
15
+ readonly modified?: number;
16
+ readonly modifiedLabel?: string;
17
+ /** A picture's or a video's preview. */
18
+ readonly thumb?: string | null;
19
+ /** Uploading: 0–1. */
20
+ readonly progress?: number;
21
+ /** Its version number (a «v3» badge; with `onVersions` a tap opens the history). */
22
+ readonly version?: number;
23
+ /** Changed recently (since the reader last looked): highlighted. */
24
+ readonly recent?: boolean;
25
+ /** A line under the name («Added by Sara»). */
26
+ readonly subtitle?: string;
27
+ }
28
+ /** A file in the upload queue (2.5.11). */
29
+ export interface G9FileUpload {
30
+ readonly id: string;
31
+ readonly name: string;
32
+ /** 0–1. */
33
+ readonly progress: number;
34
+ /** It failed: the reason, and a retry. */
35
+ readonly error?: string | null;
36
+ }
37
+ /** A name's kind from its extension. */
38
+ export declare function g9FileEntryKind(name: string): G9FileEntryKind;
39
+ /** Files sorted: folders first, then by the key (names in the Persian alphabet, Latin without case; no Intl). */
40
+ export declare function g9SortFiles(items: readonly G9FileEntry[], key: 'name' | 'modified' | 'size', dir: 'asc' | 'desc'): G9FileEntry[];
41
+ /** The kinds' icons (SVG). */
42
+ export declare const g9FileKindIcons: Readonly<Record<G9FileEntryKind, string>>;
43
+ /** Props of {@link G9FileBrowser}. */
44
+ export interface G9FileBrowserProps {
45
+ readonly id?: string;
46
+ readonly items: readonly G9FileEntry[];
47
+ /** The folders from the top to here (the breadcrumb); `rootLabel` first. */
48
+ readonly path?: readonly {
49
+ readonly id: string;
50
+ readonly name: string;
51
+ }[];
52
+ readonly rootLabel?: string;
53
+ /** A breadcrumb step (null: the top). */
54
+ readonly onNavigate?: (folderId: string | null) => void;
55
+ /** A file opened, or a folder entered. */
56
+ readonly onOpen?: (item: G9FileEntry) => void;
57
+ /** `grid` (default) or `list`; with `onViewChange` a switch. */
58
+ readonly view?: 'grid' | 'list';
59
+ readonly onViewChange?: (view: 'grid' | 'list') => void;
60
+ /** Multi-select: the chosen ids (a long press starts it; then taps toggle). */
61
+ readonly selected?: readonly string[];
62
+ readonly onSelectionChange?: (ids: readonly string[]) => void;
63
+ /** The selection's actions (move, delete) in a bar while some are chosen. */
64
+ readonly selectionActions?: ReactNode;
65
+ readonly sort?: {
66
+ readonly key: 'name' | 'modified' | 'size';
67
+ readonly dir: 'asc' | 'desc';
68
+ };
69
+ readonly onSortChange?: (sort: {
70
+ readonly key: 'name' | 'modified' | 'size';
71
+ readonly dir: 'asc' | 'desc';
72
+ }) => void;
73
+ /** An item's menu (rename, move, delete…). */
74
+ readonly menuFor?: (item: G9FileEntry) => readonly G9MenuItem[];
75
+ readonly onMenu?: (key: string, item: G9FileEntry) => void;
76
+ /** The upload button (the app's picker). */
77
+ readonly onUpload?: () => void;
78
+ /** Wraps the browser in the app's drop zone (a G9DropZone from the media package). */
79
+ readonly wrapDrop?: (content: ReactNode) => ReactNode;
80
+ /** A size in the app's words (default B / KB / MB / GB). */
81
+ readonly formatSize?: (bytes: number) => string;
82
+ readonly words?: {
83
+ readonly upload?: string;
84
+ readonly empty?: string;
85
+ readonly emptyHint?: string;
86
+ readonly grid?: string;
87
+ readonly list?: string;
88
+ readonly name?: string;
89
+ readonly modified?: string;
90
+ readonly size?: string;
91
+ readonly more?: string;
92
+ /** «3 selected». */
93
+ readonly selected?: (count: number) => string;
94
+ readonly clear?: string;
95
+ };
96
+ /** Grid columns (default 3). */
97
+ readonly columns?: number;
98
+ /** A file's version history (the badge's tap). */
99
+ readonly onVersions?: (item: G9FileEntry) => void;
100
+ /** The upload queue: rows at the top with progress, cancel and retry. */
101
+ readonly uploads?: readonly G9FileUpload[];
102
+ readonly onCancelUpload?: (id: string) => void;
103
+ readonly onRetryUpload?: (id: string) => void;
104
+ /** Audio files play in place: the app plays; this is the one playing. */
105
+ readonly playingId?: string | null;
106
+ readonly onPlay?: (item: G9FileEntry) => void;
107
+ readonly onPause?: (item: G9FileEntry) => void;
108
+ /** The app's search text (names are filtered by it; the field is the app's, in `header`). */
109
+ readonly query?: string;
110
+ /** Above the files (the app's search field, filters). */
111
+ readonly header?: ReactNode;
112
+ readonly uploadWords?: {
113
+ readonly cancel?: string;
114
+ readonly retry?: string;
115
+ readonly play?: string;
116
+ readonly pause?: string;
117
+ readonly versions?: string;
118
+ readonly noMatch?: string;
119
+ };
120
+ }
121
+ /** A project's files: folders, a breadcrumb, grid or list, previews, multi-select, uploads, menus, sorting. */
122
+ export declare function G9FileBrowser(props: G9FileBrowserProps): ReactNode;
123
+ //# sourceMappingURL=files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../src/files.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAU,KAAK,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAIrE,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,gBAAgB,CAAC;AAC1D,OAAO,aAAa,CAAC;AAErB,iCAAiC;AACjC,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,KAAK,GAAG,OAAO,CAAC;AAE7G,0BAA0B;AAC1B,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB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