@activecollab/components 2.0.421 → 2.0.422

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 (71) hide show
  1. package/dist/cjs/components/RadioCard/RadioCard.js +81 -0
  2. package/dist/cjs/components/RadioCard/RadioCard.js.map +1 -0
  3. package/dist/cjs/components/RadioCard/Styles.js +39 -0
  4. package/dist/cjs/components/RadioCard/Styles.js.map +1 -0
  5. package/dist/cjs/components/RadioCard/index.js +17 -0
  6. package/dist/cjs/components/RadioCard/index.js.map +1 -0
  7. package/dist/cjs/components/RadioGroup/RadioGroup.js +102 -0
  8. package/dist/cjs/components/RadioGroup/RadioGroup.js.map +1 -0
  9. package/dist/cjs/components/RadioGroup/Styles.js +38 -0
  10. package/dist/cjs/components/RadioGroup/Styles.js.map +1 -0
  11. package/dist/cjs/components/RadioGroup/index.js +17 -0
  12. package/dist/cjs/components/RadioGroup/index.js.map +1 -0
  13. package/dist/cjs/components/index.js +22 -0
  14. package/dist/cjs/components/index.js.map +1 -1
  15. package/dist/cjs/presentation/shared/PortfolioOptionsMenu.js +74 -15
  16. package/dist/cjs/presentation/shared/PortfolioOptionsMenu.js.map +1 -1
  17. package/dist/cjs/presentation/shared/index.js +93 -1
  18. package/dist/cjs/presentation/shared/index.js.map +1 -1
  19. package/dist/cjs/presentation/shared/portfolioDetails.js +566 -0
  20. package/dist/cjs/presentation/shared/portfolioDetails.js.map +1 -0
  21. package/dist/cjs/utils/useStableId.js +33 -0
  22. package/dist/cjs/utils/useStableId.js.map +1 -0
  23. package/dist/esm/components/RadioCard/RadioCard.d.ts +27 -0
  24. package/dist/esm/components/RadioCard/RadioCard.d.ts.map +1 -0
  25. package/dist/esm/components/RadioCard/RadioCard.js +72 -0
  26. package/dist/esm/components/RadioCard/RadioCard.js.map +1 -0
  27. package/dist/esm/components/RadioCard/Styles.d.ts +16 -0
  28. package/dist/esm/components/RadioCard/Styles.d.ts.map +1 -0
  29. package/dist/esm/components/RadioCard/Styles.js +26 -0
  30. package/dist/esm/components/RadioCard/Styles.js.map +1 -0
  31. package/dist/esm/components/RadioCard/index.d.ts +2 -0
  32. package/dist/esm/components/RadioCard/index.d.ts.map +1 -0
  33. package/dist/esm/components/RadioCard/index.js +2 -0
  34. package/dist/esm/components/RadioCard/index.js.map +1 -0
  35. package/dist/esm/components/RadioGroup/RadioGroup.d.ts +48 -0
  36. package/dist/esm/components/RadioGroup/RadioGroup.d.ts.map +1 -0
  37. package/dist/esm/components/RadioGroup/RadioGroup.js +89 -0
  38. package/dist/esm/components/RadioGroup/RadioGroup.js.map +1 -0
  39. package/dist/esm/components/RadioGroup/Styles.d.ts +22 -0
  40. package/dist/esm/components/RadioGroup/Styles.d.ts.map +1 -0
  41. package/dist/esm/components/RadioGroup/Styles.js +23 -0
  42. package/dist/esm/components/RadioGroup/Styles.js.map +1 -0
  43. package/dist/esm/components/RadioGroup/index.d.ts +2 -0
  44. package/dist/esm/components/RadioGroup/index.d.ts.map +1 -0
  45. package/dist/esm/components/RadioGroup/index.js +2 -0
  46. package/dist/esm/components/RadioGroup/index.js.map +1 -0
  47. package/dist/esm/components/index.d.ts +2 -0
  48. package/dist/esm/components/index.d.ts.map +1 -1
  49. package/dist/esm/components/index.js +2 -0
  50. package/dist/esm/components/index.js.map +1 -1
  51. package/dist/esm/presentation/shared/PortfolioOptionsMenu.d.ts +5 -1
  52. package/dist/esm/presentation/shared/PortfolioOptionsMenu.d.ts.map +1 -1
  53. package/dist/esm/presentation/shared/PortfolioOptionsMenu.js +61 -14
  54. package/dist/esm/presentation/shared/PortfolioOptionsMenu.js.map +1 -1
  55. package/dist/esm/presentation/shared/index.d.ts +2 -0
  56. package/dist/esm/presentation/shared/index.d.ts.map +1 -1
  57. package/dist/esm/presentation/shared/index.js +1 -0
  58. package/dist/esm/presentation/shared/index.js.map +1 -1
  59. package/dist/esm/presentation/shared/portfolioDetails.d.ts +74 -0
  60. package/dist/esm/presentation/shared/portfolioDetails.d.ts.map +1 -0
  61. package/dist/esm/presentation/shared/portfolioDetails.js +490 -0
  62. package/dist/esm/presentation/shared/portfolioDetails.js.map +1 -0
  63. package/dist/esm/utils/useStableId.d.ts +2 -0
  64. package/dist/esm/utils/useStableId.d.ts.map +1 -0
  65. package/dist/esm/utils/useStableId.js +25 -0
  66. package/dist/esm/utils/useStableId.js.map +1 -0
  67. package/dist/index.js +1068 -815
  68. package/dist/index.js.map +1 -1
  69. package/dist/index.min.js +1 -1
  70. package/dist/index.min.js.map +1 -1
  71. package/package.json +1 -1
@@ -0,0 +1,490 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import React, { useEffect, useMemo, useState } from "react";
3
+ import styled from "styled-components";
4
+ import { Button } from "../../components/Button";
5
+ import { Dialog } from "../../components/Dialog";
6
+ import { IconButton } from "../../components/IconButton";
7
+ import { SortGeneralIcon } from "../../components/Icons";
8
+ import { Input } from "../../components/Input";
9
+ import { Label } from "../../components/Label";
10
+ import { RadioGroup } from "../../components/RadioGroup";
11
+ import { Select } from "../../components/Select";
12
+ import { SelectTrigger } from "../../components/SelectTrigger";
13
+
14
+ /*
15
+ Portfolio details form — the shared "step 2" of the Create Portfolio wizard,
16
+ reused verbatim as the Edit Portfolio dialog.
17
+
18
+ This mirrors a pattern used across the app: the fields that make up the final
19
+ step of a creation wizard are the same fields shown, later, when the object is
20
+ edited. So the form body (name, the type's picker, visibility) and its
21
+ validation live here once, and two consumers render it:
22
+
23
+ - The Create Portfolio wizard (PortfoliosList.stories.tsx) renders
24
+ <PortfolioDetailsFields> inside its step-2 <Dialog.Content>, with a
25
+ "Create Portfolio" action.
26
+ - <EditPortfolioDialog> (opened from PortfolioOptionsMenu's Edit item)
27
+ renders the SAME <PortfolioDetailsFields> inside a standalone <Dialog>,
28
+ with a "Save Changes" action.
29
+
30
+ Both use isPortfolioDetailsValid() and the same always-enabled-submit,
31
+ outline-on-submit validation rule.
32
+ */
33
+
34
+ /* ------------------------------------------------------------------ */
35
+ /* Domain types */
36
+ /* ------------------------------------------------------------------ */
37
+
38
+ /** How a portfolio decides its members (two kinds, three context types). */
39
+
40
+ /** Grouping of the projects multi-select — matches Invite-to-Projects. */
41
+
42
+ /** The editable shape shared by create step 2 and the edit dialog. */
43
+
44
+ /** A blank custom portfolio — the fallback seed for the edit dialog. */
45
+ export const DEFAULT_PORTFOLIO_FORM_VALUES = {
46
+ type: "custom",
47
+ name: "",
48
+ context: undefined,
49
+ projectIds: [],
50
+ groupBy: "favorites",
51
+ visibility: "everyone"
52
+ };
53
+
54
+ /* ------------------------------------------------------------------ */
55
+ /* Pickers' mock data */
56
+ /* ------------------------------------------------------------------ */
57
+
58
+ export const LEADERS_LIST = [{
59
+ name: "Theo Brandt",
60
+ short: "Theo B."
61
+ }, {
62
+ name: "Isabel Cortez",
63
+ short: "Isabel C."
64
+ }, {
65
+ name: "Grace Bauer",
66
+ short: "Grace B."
67
+ }, {
68
+ name: "Noah Mercer",
69
+ short: "Noah M."
70
+ }];
71
+ export const CATEGORIES = ["Brand & Identity", "Web & Product", "Marketing", "Internal Ops"];
72
+ export const CLIENTS = ["Aperture Studio", "Orbit Telecom", "Northwind Traders", "Meridian Health"];
73
+ const PICKER_PROJECTS = [{
74
+ id: 1,
75
+ name: "Website Redesign",
76
+ client: "Aperture Studio",
77
+ category: "Web & Product",
78
+ label: "Design",
79
+ leader: "Theo Brandt",
80
+ favorite: true
81
+ }, {
82
+ id: 2,
83
+ name: "Brand Refresh",
84
+ client: "Aperture Studio",
85
+ category: "Brand & Identity",
86
+ label: "Design",
87
+ leader: "Isabel Cortez",
88
+ favorite: true
89
+ }, {
90
+ id: 3,
91
+ name: "Mobile App",
92
+ client: "Orbit Telecom",
93
+ category: "Web & Product",
94
+ label: "Build",
95
+ leader: "Grace Bauer",
96
+ favorite: false
97
+ }, {
98
+ id: 4,
99
+ name: "Q3 Campaign",
100
+ client: "Orbit Telecom",
101
+ category: "Marketing",
102
+ label: "Campaign",
103
+ leader: "Noah Mercer",
104
+ favorite: true
105
+ }, {
106
+ id: 5,
107
+ name: "Internal Wiki",
108
+ client: "",
109
+ category: "Internal Ops",
110
+ label: "",
111
+ leader: "Theo Brandt",
112
+ favorite: false
113
+ }, {
114
+ id: 6,
115
+ name: "Packaging System",
116
+ client: "Northwind Traders",
117
+ category: "Brand & Identity",
118
+ label: "Design",
119
+ leader: "Isabel Cortez",
120
+ favorite: false
121
+ }, {
122
+ id: 7,
123
+ name: "Support Portal",
124
+ client: "Meridian Health",
125
+ category: "Web & Product",
126
+ label: "Build",
127
+ leader: "Grace Bauer",
128
+ favorite: false
129
+ }, {
130
+ id: 8,
131
+ name: "Annual Report",
132
+ client: "Northwind Traders",
133
+ category: "Marketing",
134
+ label: "Campaign",
135
+ leader: "Noah Mercer",
136
+ favorite: true
137
+ }];
138
+
139
+ /* Group-by options and default match the Invite-to-Projects picker exactly. */
140
+ const GROUP_BY_OPTIONS = [{
141
+ id: "favorites",
142
+ name: "Favorites"
143
+ }, {
144
+ id: "labels",
145
+ name: "Label"
146
+ }, {
147
+ id: "companies",
148
+ name: "Client"
149
+ }, {
150
+ id: "categories",
151
+ name: "Category"
152
+ }, {
153
+ id: "leaders",
154
+ name: "Project Leader"
155
+ }];
156
+ const projectOptionId = project => "p" + project.id;
157
+
158
+ /** A small deterministic set of project option ids — seeds a custom
159
+ portfolio's edit dialog so the picker reads as an existing selection. */
160
+ export const sampleProjectOptionIds = count => PICKER_PROJECTS.slice(0, Math.max(0, count)).map(projectOptionId);
161
+ const toProjectOptions = projects => projects.map(project => ({
162
+ id: projectOptionId(project),
163
+ name: project.name
164
+ })).sort((a, b) => a.name.localeCompare(b.name));
165
+
166
+ /* Build the grouped option tree the Select expects. Alphabetical rows and
167
+ groups; the "Without ..." / "Other" bucket sits last; the Favorites grouping
168
+ collapses to a flat list when it is the only group (as the app's does). */
169
+ const groupPickerProjects = groupBy => {
170
+ if (groupBy === "favorites") {
171
+ const favorite = PICKER_PROJECTS.filter(project => project.favorite);
172
+ const other = PICKER_PROJECTS.filter(project => !project.favorite);
173
+ const groups = [];
174
+ if (favorite.length) {
175
+ groups.push({
176
+ id: "g-fav",
177
+ name: "Favorite",
178
+ options: toProjectOptions(favorite)
179
+ });
180
+ }
181
+ if (other.length) {
182
+ groups.push({
183
+ id: "g-other",
184
+ name: "Other",
185
+ options: toProjectOptions(other)
186
+ });
187
+ }
188
+ return groups.length === 1 ? groups[0].options : groups;
189
+ }
190
+ const field = groupBy === "labels" ? "label" : groupBy === "companies" ? "client" : groupBy === "categories" ? "category" : "leader";
191
+ const without = groupBy === "labels" ? "Without Label" : groupBy === "companies" ? "Without Client" : groupBy === "categories" ? "Without Category" : "Without Leader";
192
+ const buckets = new Map();
193
+ PICKER_PROJECTS.forEach(project => {
194
+ var _buckets$get;
195
+ const key = project[field] || without;
196
+ if (!buckets.has(key)) {
197
+ buckets.set(key, []);
198
+ }
199
+ (_buckets$get = buckets.get(key)) == null || _buckets$get.push(project);
200
+ });
201
+ return Array.from(buckets.entries()).map(_ref => {
202
+ let name = _ref[0],
203
+ projects = _ref[1];
204
+ return {
205
+ id: "g-" + name,
206
+ name,
207
+ options: toProjectOptions(projects)
208
+ };
209
+ }).sort((a, b) => a.name === without ? 1 : b.name === without ? -1 : a.name.localeCompare(b.name));
210
+ };
211
+
212
+ /* ------------------------------------------------------------------ */
213
+ /* Type + visibility option copy */
214
+ /* ------------------------------------------------------------------ */
215
+
216
+ export const PORTFOLIO_TYPES = [{
217
+ id: "custom",
218
+ title: "Custom Portfolio",
219
+ description: "The projects you pick by hand. Nothing joins automatically."
220
+ }, {
221
+ id: "client",
222
+ title: "Client Portfolio",
223
+ description: "All projects for a client company. New ones join automatically."
224
+ }, {
225
+ id: "leader",
226
+ title: "Project Leader Portfolio",
227
+ description: "All projects led by a person. New ones join automatically."
228
+ }, {
229
+ id: "category",
230
+ title: "Category Portfolio",
231
+ description: "All projects in a project category. New ones join automatically."
232
+ }];
233
+ export const VISIBILITY_OPTIONS = [{
234
+ id: "everyone",
235
+ title: "Visible to Everyone",
236
+ description: "Anyone who can use portfolios sees this one. They still only see the projects they already have access to."
237
+ }, {
238
+ id: "me",
239
+ title: "Visible Only to Me",
240
+ description: "Nobody else sees this portfolio."
241
+ }];
242
+ export const contextFieldLabel = type => type === "custom" ? "Projects" : type === "category" ? "Category" : type === "client" ? "Client" : "Project leader";
243
+ export const leaderShortName = name => {
244
+ var _LEADERS_LIST$find$sh, _LEADERS_LIST$find;
245
+ return (_LEADERS_LIST$find$sh = (_LEADERS_LIST$find = LEADERS_LIST.find(leader => leader.name === name)) == null ? void 0 : _LEADERS_LIST$find.short) != null ? _LEADERS_LIST$find$sh : name;
246
+ };
247
+
248
+ /* Default names: "{Category} Projects", "{Client} Projects", "Lead by {N.}". */
249
+ export const defaultPortfolioName = (type, context) => {
250
+ if (!context) return "";
251
+ if (type === "category" || type === "client") return context + " Projects";
252
+ if (type === "leader") return "Lead by " + leaderShortName(context);
253
+ return "";
254
+ };
255
+
256
+ /* ------------------------------------------------------------------ */
257
+ /* Validation (shared by create step 2 and the edit dialog) */
258
+ /* ------------------------------------------------------------------ */
259
+
260
+ /** Name is required; a custom portfolio needs at least one project, a context
261
+ portfolio needs its context chosen. Same rule for create and edit. */
262
+ export const isPortfolioDetailsValid = values => values.name.trim().length > 0 && (values.type === "custom" ? values.projectIds.length > 0 : Boolean(values.context));
263
+
264
+ /* ------------------------------------------------------------------ */
265
+ /* Pickers */
266
+ /* ------------------------------------------------------------------ */
267
+
268
+ /* Group-by control: the SortGeneralIcon button the Invite-to-Projects picker
269
+ shows as the search bar's right-side adornment. Controls grouping, not sort. */
270
+ const ProjectsGroupBy = _ref2 => {
271
+ let selected = _ref2.selected,
272
+ onChange = _ref2.onChange;
273
+ return /*#__PURE__*/React.createElement(Select, {
274
+ keepSameOptionsOrder: true,
275
+ disableSearch: true,
276
+ disabledInternalSort: true,
277
+ forceCloseMenu: true,
278
+ position: "bottom-end",
279
+ selected: selected,
280
+ onChange: value => onChange(value),
281
+ options: GROUP_BY_OPTIONS,
282
+ target: /*#__PURE__*/React.createElement(IconButton, {
283
+ type: "button",
284
+ variant: "text gray"
285
+ }, /*#__PURE__*/React.createElement(SortGeneralIcon, null))
286
+ });
287
+ };
288
+ const ProjectsPicker = _ref3 => {
289
+ let selected = _ref3.selected,
290
+ onChange = _ref3.onChange,
291
+ groupBy = _ref3.groupBy,
292
+ onGroupBy = _ref3.onGroupBy,
293
+ invalid = _ref3.invalid;
294
+ const options = useMemo(() => groupPickerProjects(groupBy), [groupBy]);
295
+ const count = selected.length;
296
+ const triggerText = count === 0 ? "Choose projects" : count === 1 ? "1 project selected" : count + " projects selected";
297
+ return /*#__PURE__*/React.createElement(Select, {
298
+ type: "multiple",
299
+ options: options,
300
+ selected: selected,
301
+ onChange: value => onChange(value),
302
+ noResultText: "No results",
303
+ endAdornment: /*#__PURE__*/React.createElement(ProjectsGroupBy, {
304
+ selected: groupBy,
305
+ onChange: onGroupBy
306
+ }),
307
+ target: /*#__PURE__*/React.createElement(SelectTrigger, {
308
+ id: "pf-projects",
309
+ className: "pf-trigger",
310
+ invalid: invalid,
311
+ typographyProps: {
312
+ color: count > 0 ? "primary" : "quaternary"
313
+ }
314
+ }, triggerText)
315
+ });
316
+ };
317
+ const ContextPicker = _ref4 => {
318
+ let type = _ref4.type,
319
+ value = _ref4.value,
320
+ onChange = _ref4.onChange,
321
+ invalid = _ref4.invalid;
322
+ const options = type === "category" ? CATEGORIES.map(name => ({
323
+ id: name,
324
+ name
325
+ })) : type === "client" ? CLIENTS.map(name => ({
326
+ id: name,
327
+ name
328
+ })) : LEADERS_LIST.map(leader => ({
329
+ id: leader.name,
330
+ name: leader.name
331
+ }));
332
+ const placeholder = type === "category" ? "Choose a category" : type === "client" ? "Choose a client" : "Choose a project leader";
333
+ return /*#__PURE__*/React.createElement(Select, {
334
+ forceCloseMenu: true,
335
+ options: options,
336
+ selected: value != null ? value : "",
337
+ onChange: next => onChange(String(next)),
338
+ target: /*#__PURE__*/React.createElement(SelectTrigger, {
339
+ id: "pf-context",
340
+ className: "pf-trigger",
341
+ invalid: invalid,
342
+ typographyProps: {
343
+ color: value ? "primary" : "quaternary"
344
+ }
345
+ }, value != null ? value : placeholder)
346
+ });
347
+ };
348
+
349
+ /* ------------------------------------------------------------------ */
350
+ /* The reusable form body */
351
+ /* ------------------------------------------------------------------ */
352
+
353
+ const StyledDetailsForm = styled.div.withConfig({
354
+ displayName: "portfolioDetails__StyledDetailsForm",
355
+ componentId: "sc-yxi1uj-0"
356
+ })(["display:flex;flex-direction:column;gap:24px;.field{display:flex;flex-direction:column;gap:8px;}.field .c-input-wrapper{width:100%;}.field .pf-trigger{width:100%;}"]);
357
+ /** Name + the type's picker + visibility. No Dialog wrappers and no action
358
+ button — the consumer (create step or edit dialog) supplies those. */
359
+ export const PortfolioDetailsFields = _ref5 => {
360
+ let values = _ref5.values,
361
+ onName = _ref5.onName,
362
+ onContext = _ref5.onContext,
363
+ onProjects = _ref5.onProjects,
364
+ onGroupBy = _ref5.onGroupBy,
365
+ onVisibility = _ref5.onVisibility,
366
+ showErrors = _ref5.showErrors;
367
+ const type = values.type,
368
+ name = values.name,
369
+ context = values.context,
370
+ projectIds = values.projectIds,
371
+ groupBy = values.groupBy,
372
+ visibility = values.visibility;
373
+ const nameInvalid = showErrors && name.trim().length === 0;
374
+ const pickerInvalid = showErrors && (type === "custom" ? projectIds.length === 0 : !context);
375
+ return /*#__PURE__*/React.createElement(StyledDetailsForm, null, /*#__PURE__*/React.createElement("div", {
376
+ className: "field"
377
+ }, /*#__PURE__*/React.createElement(Label, {
378
+ htmlFor: "pf-name"
379
+ }, "Name"), /*#__PURE__*/React.createElement(Input, {
380
+ id: "pf-name",
381
+ value: name,
382
+ placeholder: "Portfolio name",
383
+ invalid: nameInvalid,
384
+ onChange: event => onName(event.target.value)
385
+ })), /*#__PURE__*/React.createElement("div", {
386
+ className: "field"
387
+ }, /*#__PURE__*/React.createElement(Label, {
388
+ htmlFor: type === "custom" ? "pf-projects" : "pf-context"
389
+ }, contextFieldLabel(type)), type === "custom" ? /*#__PURE__*/React.createElement(ProjectsPicker, {
390
+ selected: projectIds,
391
+ onChange: onProjects,
392
+ groupBy: groupBy,
393
+ onGroupBy: onGroupBy,
394
+ invalid: pickerInvalid
395
+ }) : /*#__PURE__*/React.createElement(ContextPicker, {
396
+ type: type,
397
+ value: context,
398
+ onChange: onContext,
399
+ invalid: pickerInvalid
400
+ })), /*#__PURE__*/React.createElement("div", {
401
+ className: "field"
402
+ }, /*#__PURE__*/React.createElement(RadioGroup, {
403
+ label: "Visibility",
404
+ variant: "plain",
405
+ value: visibility,
406
+ onChange: value => onVisibility(value),
407
+ options: VISIBILITY_OPTIONS.map(option => ({
408
+ id: option.id,
409
+ name: option.title,
410
+ description: option.description
411
+ }))
412
+ })));
413
+ };
414
+ PortfolioDetailsFields.displayName = "PortfolioDetailsFields";
415
+
416
+ /* ------------------------------------------------------------------ */
417
+ /* Edit Portfolio dialog — the create wizard's step 2, on its own */
418
+ /* ------------------------------------------------------------------ */
419
+
420
+ /*
421
+ Same fields, same validation as create step 2. The type is fixed to the
422
+ portfolio's kind (edit changes the details, not the kind), so there is no
423
+ type radio here — only the name, the type's picker, and visibility.
424
+ */
425
+ export const EditPortfolioDialog = _ref6 => {
426
+ let open = _ref6.open,
427
+ initialValues = _ref6.initialValues,
428
+ onClose = _ref6.onClose,
429
+ onSave = _ref6.onSave;
430
+ const _useState = useState(initialValues),
431
+ values = _useState[0],
432
+ setValues = _useState[1];
433
+ const _useState2 = useState(false),
434
+ showErrors = _useState2[0],
435
+ setShowErrors = _useState2[1];
436
+
437
+ /* Re-seed from the portfolio each time the dialog opens. */
438
+ useEffect(() => {
439
+ if (open) {
440
+ setValues(initialValues);
441
+ setShowErrors(false);
442
+ }
443
+ // Seed on open only — initialValues is read at that moment by design.
444
+ // eslint-disable-next-line react-hooks/exhaustive-deps
445
+ }, [open]);
446
+ const patch = next => setValues(current => _extends({}, current, next));
447
+ const handleSave = () => {
448
+ if (!isPortfolioDetailsValid(values)) {
449
+ setShowErrors(true);
450
+ return;
451
+ }
452
+ onSave == null || onSave(values);
453
+ onClose();
454
+ };
455
+ return /*#__PURE__*/React.createElement(Dialog, {
456
+ open: open,
457
+ onClose: onClose,
458
+ disableCloseOnEsc: true
459
+ }, /*#__PURE__*/React.createElement(Dialog.Title, null, "Edit Portfolio"), /*#__PURE__*/React.createElement(Dialog.ContentDivider, null), /*#__PURE__*/React.createElement(Dialog.Content, null, /*#__PURE__*/React.createElement(PortfolioDetailsFields, {
460
+ values: values,
461
+ onName: name => patch({
462
+ name
463
+ }),
464
+ onContext: context => patch({
465
+ context
466
+ }),
467
+ onProjects: projectIds => patch({
468
+ projectIds
469
+ }),
470
+ onGroupBy: groupBy => patch({
471
+ groupBy
472
+ }),
473
+ onVisibility: visibility => patch({
474
+ visibility
475
+ }),
476
+ showErrors: showErrors
477
+ })), /*#__PURE__*/React.createElement(Dialog.ContentDivider, null), /*#__PURE__*/React.createElement(Dialog.Actions, null, /*#__PURE__*/React.createElement(Button, {
478
+ variant: "primary",
479
+ style: {
480
+ marginRight: "12px"
481
+ },
482
+ onClick: handleSave
483
+ }, "Save Changes"), /*#__PURE__*/React.createElement(Button, {
484
+ variant: "secondary",
485
+ "data-action": "cancel",
486
+ onClick: onClose
487
+ }, "Cancel")));
488
+ };
489
+ EditPortfolioDialog.displayName = "EditPortfolioDialog";
490
+ //# sourceMappingURL=portfolioDetails.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portfolioDetails.js","names":["React","useEffect","useMemo","useState","styled","Button","Dialog","IconButton","SortGeneralIcon","Input","Label","RadioGroup","Select","SelectTrigger","DEFAULT_PORTFOLIO_FORM_VALUES","type","name","context","undefined","projectIds","groupBy","visibility","LEADERS_LIST","short","CATEGORIES","CLIENTS","PICKER_PROJECTS","id","client","category","label","leader","favorite","GROUP_BY_OPTIONS","projectOptionId","project","sampleProjectOptionIds","count","slice","Math","max","map","toProjectOptions","projects","sort","a","b","localeCompare","groupPickerProjects","filter","other","groups","length","push","options","field","without","buckets","Map","forEach","_buckets$get","key","has","set","get","Array","from","entries","_ref","PORTFOLIO_TYPES","title","description","VISIBILITY_OPTIONS","contextFieldLabel","leaderShortName","_LEADERS_LIST$find$sh","_LEADERS_LIST$find","find","defaultPortfolioName","isPortfolioDetailsValid","values","trim","Boolean","ProjectsGroupBy","_ref2","selected","onChange","createElement","keepSameOptionsOrder","disableSearch","disabledInternalSort","forceCloseMenu","position","value","target","variant","ProjectsPicker","_ref3","onGroupBy","invalid","triggerText","noResultText","endAdornment","className","typographyProps","color","ContextPicker","_ref4","placeholder","next","String","StyledDetailsForm","div","withConfig","displayName","componentId","PortfolioDetailsFields","_ref5","onName","onContext","onProjects","onVisibility","showErrors","nameInvalid","pickerInvalid","htmlFor","event","option","EditPortfolioDialog","_ref6","open","initialValues","onClose","onSave","_useState","setValues","_useState2","setShowErrors","patch","current","_extends","handleSave","disableCloseOnEsc","Title","ContentDivider","Content","Actions","style","marginRight","onClick"],"sources":["../../../../src/presentation/shared/portfolioDetails.tsx"],"sourcesContent":["import React, { ReactElement, useEffect, useMemo, useState } from \"react\";\n\nimport styled from \"styled-components\";\n\nimport { Button } from \"../../components/Button\";\nimport { Dialog } from \"../../components/Dialog\";\nimport { IconButton } from \"../../components/IconButton\";\nimport { SortGeneralIcon } from \"../../components/Icons\";\nimport { Input } from \"../../components/Input\";\nimport { Label } from \"../../components/Label\";\nimport { RadioGroup } from \"../../components/RadioGroup\";\nimport { Select } from \"../../components/Select\";\nimport { SelectTrigger } from \"../../components/SelectTrigger\";\n\n/*\n Portfolio details form — the shared \"step 2\" of the Create Portfolio wizard,\n reused verbatim as the Edit Portfolio dialog.\n\n This mirrors a pattern used across the app: the fields that make up the final\n step of a creation wizard are the same fields shown, later, when the object is\n edited. So the form body (name, the type's picker, visibility) and its\n validation live here once, and two consumers render it:\n\n - The Create Portfolio wizard (PortfoliosList.stories.tsx) renders\n <PortfolioDetailsFields> inside its step-2 <Dialog.Content>, with a\n \"Create Portfolio\" action.\n - <EditPortfolioDialog> (opened from PortfolioOptionsMenu's Edit item)\n renders the SAME <PortfolioDetailsFields> inside a standalone <Dialog>,\n with a \"Save Changes\" action.\n\n Both use isPortfolioDetailsValid() and the same always-enabled-submit,\n outline-on-submit validation rule.\n*/\n\n/* ------------------------------------------------------------------ */\n/* Domain types */\n/* ------------------------------------------------------------------ */\n\n/** How a portfolio decides its members (two kinds, three context types). */\nexport type PortfolioKind = \"custom\" | \"category\" | \"client\" | \"leader\";\n\nexport type PortfolioVisibility = \"everyone\" | \"me\";\n\n/** Grouping of the projects multi-select — matches Invite-to-Projects. */\nexport type GroupBy =\n | \"favorites\"\n | \"labels\"\n | \"companies\"\n | \"categories\"\n | \"leaders\";\n\n/** The editable shape shared by create step 2 and the edit dialog. */\nexport interface PortfolioFormValues {\n type: PortfolioKind;\n name: string;\n /** For context portfolios: the chosen category / client / leader. */\n context?: string;\n /** For custom portfolios: the hand-picked project option ids. */\n projectIds: string[];\n groupBy: GroupBy;\n visibility: PortfolioVisibility;\n}\n\n/** A blank custom portfolio — the fallback seed for the edit dialog. */\nexport const DEFAULT_PORTFOLIO_FORM_VALUES: PortfolioFormValues = {\n type: \"custom\",\n name: \"\",\n context: undefined,\n projectIds: [],\n groupBy: \"favorites\",\n visibility: \"everyone\",\n};\n\n/* ------------------------------------------------------------------ */\n/* Pickers' mock data */\n/* ------------------------------------------------------------------ */\n\nexport interface PickerLeader {\n name: string;\n /** Short \"Firstname L.\" form used in the default portfolio name. */\n short: string;\n}\n\nexport const LEADERS_LIST: PickerLeader[] = [\n { name: \"Theo Brandt\", short: \"Theo B.\" },\n { name: \"Isabel Cortez\", short: \"Isabel C.\" },\n { name: \"Grace Bauer\", short: \"Grace B.\" },\n { name: \"Noah Mercer\", short: \"Noah M.\" },\n];\n\nexport const CATEGORIES = [\n \"Brand & Identity\",\n \"Web & Product\",\n \"Marketing\",\n \"Internal Ops\",\n];\n\nexport const CLIENTS = [\n \"Aperture Studio\",\n \"Orbit Telecom\",\n \"Northwind Traders\",\n \"Meridian Health\",\n];\n\ninterface PickerProject {\n id: number;\n name: string;\n client: string;\n category: string;\n label: string;\n leader: string;\n favorite: boolean;\n}\n\nconst PICKER_PROJECTS: PickerProject[] = [\n {\n id: 1,\n name: \"Website Redesign\",\n client: \"Aperture Studio\",\n category: \"Web & Product\",\n label: \"Design\",\n leader: \"Theo Brandt\",\n favorite: true,\n },\n {\n id: 2,\n name: \"Brand Refresh\",\n client: \"Aperture Studio\",\n category: \"Brand & Identity\",\n label: \"Design\",\n leader: \"Isabel Cortez\",\n favorite: true,\n },\n {\n id: 3,\n name: \"Mobile App\",\n client: \"Orbit Telecom\",\n category: \"Web & Product\",\n label: \"Build\",\n leader: \"Grace Bauer\",\n favorite: false,\n },\n {\n id: 4,\n name: \"Q3 Campaign\",\n client: \"Orbit Telecom\",\n category: \"Marketing\",\n label: \"Campaign\",\n leader: \"Noah Mercer\",\n favorite: true,\n },\n {\n id: 5,\n name: \"Internal Wiki\",\n client: \"\",\n category: \"Internal Ops\",\n label: \"\",\n leader: \"Theo Brandt\",\n favorite: false,\n },\n {\n id: 6,\n name: \"Packaging System\",\n client: \"Northwind Traders\",\n category: \"Brand & Identity\",\n label: \"Design\",\n leader: \"Isabel Cortez\",\n favorite: false,\n },\n {\n id: 7,\n name: \"Support Portal\",\n client: \"Meridian Health\",\n category: \"Web & Product\",\n label: \"Build\",\n leader: \"Grace Bauer\",\n favorite: false,\n },\n {\n id: 8,\n name: \"Annual Report\",\n client: \"Northwind Traders\",\n category: \"Marketing\",\n label: \"Campaign\",\n leader: \"Noah Mercer\",\n favorite: true,\n },\n];\n\n/* Group-by options and default match the Invite-to-Projects picker exactly. */\nconst GROUP_BY_OPTIONS: { id: GroupBy; name: string }[] = [\n { id: \"favorites\", name: \"Favorites\" },\n { id: \"labels\", name: \"Label\" },\n { id: \"companies\", name: \"Client\" },\n { id: \"categories\", name: \"Category\" },\n { id: \"leaders\", name: \"Project Leader\" },\n];\n\ninterface ProjectOption {\n id: string;\n name: string;\n}\ninterface ProjectOptionGroup {\n id: string;\n name: string;\n options: ProjectOption[];\n}\n\nconst projectOptionId = (project: PickerProject): string => `p${project.id}`;\n\n/** A small deterministic set of project option ids — seeds a custom\n portfolio's edit dialog so the picker reads as an existing selection. */\nexport const sampleProjectOptionIds = (count: number): string[] =>\n PICKER_PROJECTS.slice(0, Math.max(0, count)).map(projectOptionId);\n\nconst toProjectOptions = (projects: PickerProject[]): ProjectOption[] =>\n projects\n .map((project) => ({ id: projectOptionId(project), name: project.name }))\n .sort((a, b) => a.name.localeCompare(b.name));\n\n/* Build the grouped option tree the Select expects. Alphabetical rows and\n groups; the \"Without ...\" / \"Other\" bucket sits last; the Favorites grouping\n collapses to a flat list when it is the only group (as the app's does). */\nconst groupPickerProjects = (\n groupBy: GroupBy\n): ProjectOption[] | ProjectOptionGroup[] => {\n if (groupBy === \"favorites\") {\n const favorite = PICKER_PROJECTS.filter((project) => project.favorite);\n const other = PICKER_PROJECTS.filter((project) => !project.favorite);\n const groups: ProjectOptionGroup[] = [];\n if (favorite.length) {\n groups.push({\n id: \"g-fav\",\n name: \"Favorite\",\n options: toProjectOptions(favorite),\n });\n }\n if (other.length) {\n groups.push({\n id: \"g-other\",\n name: \"Other\",\n options: toProjectOptions(other),\n });\n }\n return groups.length === 1 ? groups[0].options : groups;\n }\n\n const field: keyof PickerProject =\n groupBy === \"labels\"\n ? \"label\"\n : groupBy === \"companies\"\n ? \"client\"\n : groupBy === \"categories\"\n ? \"category\"\n : \"leader\";\n const without =\n groupBy === \"labels\"\n ? \"Without Label\"\n : groupBy === \"companies\"\n ? \"Without Client\"\n : groupBy === \"categories\"\n ? \"Without Category\"\n : \"Without Leader\";\n\n const buckets = new Map<string, PickerProject[]>();\n PICKER_PROJECTS.forEach((project) => {\n const key = (project[field] as string) || without;\n if (!buckets.has(key)) {\n buckets.set(key, []);\n }\n buckets.get(key)?.push(project);\n });\n\n return Array.from(buckets.entries())\n .map(([name, projects]) => ({\n id: `g-${name}`,\n name,\n options: toProjectOptions(projects),\n }))\n .sort((a, b) =>\n a.name === without\n ? 1\n : b.name === without\n ? -1\n : a.name.localeCompare(b.name)\n );\n};\n\n/* ------------------------------------------------------------------ */\n/* Type + visibility option copy */\n/* ------------------------------------------------------------------ */\n\nexport const PORTFOLIO_TYPES: {\n id: PortfolioKind;\n title: string;\n description: string;\n}[] = [\n {\n id: \"custom\",\n title: \"Custom Portfolio\",\n description: \"The projects you pick by hand. Nothing joins automatically.\",\n },\n {\n id: \"client\",\n title: \"Client Portfolio\",\n description:\n \"All projects for a client company. New ones join automatically.\",\n },\n {\n id: \"leader\",\n title: \"Project Leader Portfolio\",\n description: \"All projects led by a person. New ones join automatically.\",\n },\n {\n id: \"category\",\n title: \"Category Portfolio\",\n description:\n \"All projects in a project category. New ones join automatically.\",\n },\n];\n\nexport const VISIBILITY_OPTIONS: {\n id: PortfolioVisibility;\n title: string;\n description: string;\n}[] = [\n {\n id: \"everyone\",\n title: \"Visible to Everyone\",\n description:\n \"Anyone who can use portfolios sees this one. They still only see the projects they already have access to.\",\n },\n {\n id: \"me\",\n title: \"Visible Only to Me\",\n description: \"Nobody else sees this portfolio.\",\n },\n];\n\nexport const contextFieldLabel = (type: PortfolioKind): string =>\n type === \"custom\"\n ? \"Projects\"\n : type === \"category\"\n ? \"Category\"\n : type === \"client\"\n ? \"Client\"\n : \"Project leader\";\n\nexport const leaderShortName = (name: string): string =>\n LEADERS_LIST.find((leader) => leader.name === name)?.short ?? name;\n\n/* Default names: \"{Category} Projects\", \"{Client} Projects\", \"Lead by {N.}\". */\nexport const defaultPortfolioName = (\n type: PortfolioKind,\n context: string\n): string => {\n if (!context) return \"\";\n if (type === \"category\" || type === \"client\") return `${context} Projects`;\n if (type === \"leader\") return `Lead by ${leaderShortName(context)}`;\n return \"\";\n};\n\n/* ------------------------------------------------------------------ */\n/* Validation (shared by create step 2 and the edit dialog) */\n/* ------------------------------------------------------------------ */\n\n/** Name is required; a custom portfolio needs at least one project, a context\n portfolio needs its context chosen. Same rule for create and edit. */\nexport const isPortfolioDetailsValid = (values: PortfolioFormValues): boolean =>\n values.name.trim().length > 0 &&\n (values.type === \"custom\"\n ? values.projectIds.length > 0\n : Boolean(values.context));\n\n/* ------------------------------------------------------------------ */\n/* Pickers */\n/* ------------------------------------------------------------------ */\n\n/* Group-by control: the SortGeneralIcon button the Invite-to-Projects picker\n shows as the search bar's right-side adornment. Controls grouping, not sort. */\nconst ProjectsGroupBy = ({\n selected,\n onChange,\n}: {\n selected: GroupBy;\n onChange: (groupBy: GroupBy) => void;\n}): ReactElement => (\n <Select\n keepSameOptionsOrder\n disableSearch\n disabledInternalSort\n forceCloseMenu\n position=\"bottom-end\"\n selected={selected}\n onChange={(value) => onChange(value as GroupBy)}\n options={GROUP_BY_OPTIONS}\n target={\n <IconButton type=\"button\" variant=\"text gray\">\n <SortGeneralIcon />\n </IconButton>\n }\n />\n);\n\nconst ProjectsPicker = ({\n selected,\n onChange,\n groupBy,\n onGroupBy,\n invalid,\n}: {\n selected: string[];\n onChange: (ids: string[]) => void;\n groupBy: GroupBy;\n onGroupBy: (groupBy: GroupBy) => void;\n invalid?: boolean;\n}): ReactElement => {\n const options = useMemo(() => groupPickerProjects(groupBy), [groupBy]);\n const count = selected.length;\n const triggerText =\n count === 0\n ? \"Choose projects\"\n : count === 1\n ? \"1 project selected\"\n : `${count} projects selected`;\n return (\n <Select\n type=\"multiple\"\n options={options}\n selected={selected}\n onChange={(value) => onChange(value as string[])}\n noResultText=\"No results\"\n endAdornment={<ProjectsGroupBy selected={groupBy} onChange={onGroupBy} />}\n target={\n <SelectTrigger\n id=\"pf-projects\"\n className=\"pf-trigger\"\n invalid={invalid}\n typographyProps={{ color: count > 0 ? \"primary\" : \"quaternary\" }}\n >\n {triggerText}\n </SelectTrigger>\n }\n />\n );\n};\n\nconst ContextPicker = ({\n type,\n value,\n onChange,\n invalid,\n}: {\n type: PortfolioKind;\n value?: string;\n onChange: (value: string) => void;\n invalid?: boolean;\n}): ReactElement => {\n const options =\n type === \"category\"\n ? CATEGORIES.map((name) => ({ id: name, name }))\n : type === \"client\"\n ? CLIENTS.map((name) => ({ id: name, name }))\n : LEADERS_LIST.map((leader) => ({ id: leader.name, name: leader.name }));\n const placeholder =\n type === \"category\"\n ? \"Choose a category\"\n : type === \"client\"\n ? \"Choose a client\"\n : \"Choose a project leader\";\n return (\n <Select\n forceCloseMenu\n options={options}\n selected={value ?? \"\"}\n onChange={(next) => onChange(String(next))}\n target={\n <SelectTrigger\n id=\"pf-context\"\n className=\"pf-trigger\"\n invalid={invalid}\n typographyProps={{ color: value ? \"primary\" : \"quaternary\" }}\n >\n {value ?? placeholder}\n </SelectTrigger>\n }\n />\n );\n};\n\n/* ------------------------------------------------------------------ */\n/* The reusable form body */\n/* ------------------------------------------------------------------ */\n\nconst StyledDetailsForm = styled.div`\n display: flex;\n flex-direction: column;\n gap: 24px;\n\n .field {\n display: flex;\n flex-direction: column;\n gap: 8px;\n }\n\n /* DS form controls are fixed-width (Input 360px, SelectTrigger 300px); let\n them fill the dialog column instead. */\n .field .c-input-wrapper {\n width: 100%;\n }\n\n .field .pf-trigger {\n width: 100%;\n }\n`;\n\nexport interface PortfolioDetailsFieldsProps {\n values: PortfolioFormValues;\n onName: (value: string) => void;\n onContext: (value: string) => void;\n onProjects: (ids: string[]) => void;\n onGroupBy: (groupBy: GroupBy) => void;\n onVisibility: (value: PortfolioVisibility) => void;\n /* Form pattern (propagating through the app): the submit button is ALWAYS\n enabled. On submit the consumer flips showErrors; each field then outlines\n itself (aria-invalid) while it is invalid, and clears once it becomes\n valid. No field disables submit. */\n showErrors: boolean;\n}\n\n/** Name + the type's picker + visibility. No Dialog wrappers and no action\n button — the consumer (create step or edit dialog) supplies those. */\nexport const PortfolioDetailsFields = ({\n values,\n onName,\n onContext,\n onProjects,\n onGroupBy,\n onVisibility,\n showErrors,\n}: PortfolioDetailsFieldsProps): ReactElement => {\n const { type, name, context, projectIds, groupBy, visibility } = values;\n const nameInvalid = showErrors && name.trim().length === 0;\n const pickerInvalid =\n showErrors && (type === \"custom\" ? projectIds.length === 0 : !context);\n\n return (\n <StyledDetailsForm>\n <div className=\"field\">\n <Label htmlFor=\"pf-name\">Name</Label>\n <Input\n id=\"pf-name\"\n value={name}\n placeholder=\"Portfolio name\"\n invalid={nameInvalid}\n onChange={(event) => onName(event.target.value)}\n />\n </div>\n <div className=\"field\">\n <Label htmlFor={type === \"custom\" ? \"pf-projects\" : \"pf-context\"}>\n {contextFieldLabel(type)}\n </Label>\n {type === \"custom\" ? (\n <ProjectsPicker\n selected={projectIds}\n onChange={onProjects}\n groupBy={groupBy}\n onGroupBy={onGroupBy}\n invalid={pickerInvalid}\n />\n ) : (\n <ContextPicker\n type={type}\n value={context}\n onChange={onContext}\n invalid={pickerInvalid}\n />\n )}\n </div>\n <div className=\"field\">\n <RadioGroup\n label=\"Visibility\"\n variant=\"plain\"\n value={visibility}\n onChange={(value) => onVisibility(value as PortfolioVisibility)}\n options={VISIBILITY_OPTIONS.map((option) => ({\n id: option.id,\n name: option.title,\n description: option.description,\n }))}\n />\n </div>\n </StyledDetailsForm>\n );\n};\n\nPortfolioDetailsFields.displayName = \"PortfolioDetailsFields\";\n\n/* ------------------------------------------------------------------ */\n/* Edit Portfolio dialog — the create wizard's step 2, on its own */\n/* ------------------------------------------------------------------ */\n\nexport interface EditPortfolioDialogProps {\n open: boolean;\n /** The portfolio's current values; the dialog seeds itself from these on\n open, so Cancel discards edits and Save commits them. */\n initialValues: PortfolioFormValues;\n onClose: () => void;\n onSave?: (values: PortfolioFormValues) => void;\n}\n\n/*\n Same fields, same validation as create step 2. The type is fixed to the\n portfolio's kind (edit changes the details, not the kind), so there is no\n type radio here — only the name, the type's picker, and visibility.\n*/\nexport const EditPortfolioDialog = ({\n open,\n initialValues,\n onClose,\n onSave,\n}: EditPortfolioDialogProps): ReactElement => {\n const [values, setValues] = useState<PortfolioFormValues>(initialValues);\n const [showErrors, setShowErrors] = useState(false);\n\n /* Re-seed from the portfolio each time the dialog opens. */\n useEffect(() => {\n if (open) {\n setValues(initialValues);\n setShowErrors(false);\n }\n // Seed on open only — initialValues is read at that moment by design.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open]);\n\n const patch = (next: Partial<PortfolioFormValues>): void =>\n setValues((current) => ({ ...current, ...next }));\n\n const handleSave = (): void => {\n if (!isPortfolioDetailsValid(values)) {\n setShowErrors(true);\n return;\n }\n onSave?.(values);\n onClose();\n };\n\n return (\n <Dialog open={open} onClose={onClose} disableCloseOnEsc>\n <Dialog.Title>Edit Portfolio</Dialog.Title>\n <Dialog.ContentDivider />\n <Dialog.Content>\n <PortfolioDetailsFields\n values={values}\n onName={(name) => patch({ name })}\n onContext={(context) => patch({ context })}\n onProjects={(projectIds) => patch({ projectIds })}\n onGroupBy={(groupBy) => patch({ groupBy })}\n onVisibility={(visibility) => patch({ visibility })}\n showErrors={showErrors}\n />\n </Dialog.Content>\n <Dialog.ContentDivider />\n <Dialog.Actions>\n <Button\n variant=\"primary\"\n style={{ marginRight: \"12px\" }}\n onClick={handleSave}\n >\n Save Changes\n </Button>\n <Button variant=\"secondary\" data-action=\"cancel\" onClick={onClose}>\n Cancel\n </Button>\n </Dialog.Actions>\n </Dialog>\n );\n};\n\nEditPortfolioDialog.displayName = \"EditPortfolioDialog\";\n"],"mappings":";AAAA,OAAOA,KAAK,IAAkBC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAEzE,OAAOC,MAAM,MAAM,mBAAmB;AAEtC,SAASC,MAAM,QAAQ,yBAAyB;AAChD,SAASC,MAAM,QAAQ,yBAAyB;AAChD,SAASC,UAAU,QAAQ,6BAA6B;AACxD,SAASC,eAAe,QAAQ,wBAAwB;AACxD,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SAASC,KAAK,QAAQ,wBAAwB;AAC9C,SAASC,UAAU,QAAQ,6BAA6B;AACxD,SAASC,MAAM,QAA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AAW;IAAC,eAAY,QAAQ;IAACsD,OAAO,EAAEjB;EAAQ,GAAC,QAE3D,CACM,CACV,CAAC;AAEb,CAAC;AAEDJ,mBAAmB,CAACd,WAAW,GAAG,qBAAqB","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export default function useStableId(providedId?: string): string;
2
+ //# sourceMappingURL=useStableId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStableId.d.ts","sourceRoot":"","sources":["../../../src/utils/useStableId.ts"],"names":[],"mappings":"AAkBA,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAQ/D"}
@@ -0,0 +1,25 @@
1
+ import * as React from "react";
2
+
3
+ /**
4
+ * Stable id generator for a single element.
5
+ *
6
+ * `React.useId` only exists in React 18+. This package still declares React
7
+ * 16/17 in `peerDependencies`, so we must not call `React.useId` directly.
8
+ * Instead we read it off the React export once, at module load, and fall back
9
+ * to a module-level counter when it is absent. Which branch runs is fixed for
10
+ * the life of the module, so the hook call order stays stable across renders.
11
+ *
12
+ * Intentionally NOT re-exported from `src/utils/index.ts`: the package root
13
+ * re-exports `./utils`, and this helper is internal to the radio components.
14
+ */
15
+ let counter = 0;
16
+ const reactUseId = React.useId;
17
+ export default function useStableId(providedId) {
18
+ const generatedId = reactUseId ?
19
+ // eslint-disable-next-line react-hooks/rules-of-hooks
20
+ reactUseId() :
21
+ // eslint-disable-next-line react-hooks/rules-of-hooks
22
+ React.useMemo(() => "ds-" + (counter += 1), []);
23
+ return providedId != null ? providedId : generatedId;
24
+ }
25
+ //# sourceMappingURL=useStableId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStableId.js","names":["React","counter","reactUseId","useId","useStableId","providedId","generatedId","useMemo"],"sources":["../../../src/utils/useStableId.ts"],"sourcesContent":["import * as React from \"react\";\n\n/**\n * Stable id generator for a single element.\n *\n * `React.useId` only exists in React 18+. This package still declares React\n * 16/17 in `peerDependencies`, so we must not call `React.useId` directly.\n * Instead we read it off the React export once, at module load, and fall back\n * to a module-level counter when it is absent. Which branch runs is fixed for\n * the life of the module, so the hook call order stays stable across renders.\n *\n * Intentionally NOT re-exported from `src/utils/index.ts`: the package root\n * re-exports `./utils`, and this helper is internal to the radio components.\n */\nlet counter = 0;\n\nconst reactUseId = (React as { useId?: () => string }).useId;\n\nexport default function useStableId(providedId?: string): string {\n const generatedId = reactUseId\n ? // eslint-disable-next-line react-hooks/rules-of-hooks\n reactUseId()\n : // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useMemo(() => `ds-${(counter += 1)}`, []);\n\n return providedId ?? generatedId;\n}\n"],"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;;AAE9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,OAAO,GAAG,CAAC;AAEf,MAAMC,UAAU,GAAIF,KAAK,CAA8BG,KAAK;AAE5D,eAAe,SAASC,WAAWA,CAACC,UAAmB,EAAU;EAC/D,MAAMC,WAAW,GAAGJ,UAAU;EAC1B;EACAA,UAAU,CAAC,CAAC;EACZ;EACAF,KAAK,CAACO,OAAO,CAAC,eAAaN,OAAO,IAAI,CAAC,CAAG,EAAE,EAAE,CAAC;EAEnD,OAAOI,UAAU,WAAVA,UAAU,GAAIC,WAAW;AAClC","ignoreList":[]}