@activecollab/components 2.0.366 → 2.0.367

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.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.isOverdue = exports.formatDateRange = exports.dayOffset = exports.TimeCell = exports.LabelsProvider = exports.LabelCell = exports.DateCell = void 0;
6
+ exports.isOverdue = exports.formatDateRange = exports.dayOffset = exports.TimeCell = exports.LabelsProvider = exports.LabelCell = exports.IdentifierCell = exports.DateCell = void 0;
7
7
  var _react = _interopRequireWildcard(require("react"));
8
8
  var _momentTimezone = _interopRequireDefault(require("moment-timezone"));
9
9
  var _styledComponents = _interopRequireWildcard(require("styled-components"));
@@ -24,8 +24,9 @@ var _Transitions = require("../../components/Transitions");
24
24
  var _Typography = require("../../components/Typography");
25
25
  var _utils = require("../../utils");
26
26
  var _excluded = ["open", "className", "children"],
27
- _excluded2 = ["labels"],
28
- _excluded3 = ["value", "tooltip", "overdue"];
27
+ _excluded2 = ["value", "tooltip"],
28
+ _excluded3 = ["labels"],
29
+ _excluded4 = ["value", "tooltip", "overdue"];
29
30
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
30
31
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
31
32
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -43,10 +44,16 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
43
44
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
44
45
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
45
46
  /**
46
- * Interactive list-view column cells for the `Presentation/List view` story —
47
- * the Label, Date and Time cells with their editors, mirroring
48
- * `new-activecollab-front/src/components/ListView/columns/*`:
47
+ * Interactive list-view column cells for the `Presentation/List view` and
48
+ * `Presentation/List View ID Column` stories — the Label, Date and Time cells
49
+ * with their editors, mirroring
50
+ * `new-activecollab-front/src/components/ListView/columns/*`, plus an
51
+ * Identifier cell that only the ID-column story uses (it has no counterpart in
52
+ * the app yet):
49
53
  *
54
+ * - **Identifier** (no app equivalent): `#<id>` as a Copy Link trigger, styled
55
+ * like the Date trigger. One typography at every length — the column's width
56
+ * is what adapts to how large the identifiers get.
50
57
  * - **Label** (`columns/Label.js` + `LabelTrigger`/`LabelItems`): chips for 1–2
51
58
  * labels, dots from 3 up, `+N` past 8, and a DS `Select` picker (search,
52
59
  * colored dot + label name in the label's own colour, checkbox, "+ Add new").
@@ -107,6 +114,74 @@ var StyledListButton = (0, _styledComponents.default)(ListButtonBase).withConfig
107
114
  componentId: "sc-9f4385-0"
108
115
  })(["&&{display:inline-flex;align-items:center;justify-content:flex-end;width:auto;min-width:0;max-width:100%;padding:4px 8px;overflow:visible;text-align:right;}", ""], CooltipStyle);
109
116
 
117
+ /* ================================================================== */
118
+ /* Identifier (task ID) */
119
+ /* ================================================================== */
120
+
121
+ var StyledIdValue = _styledComponents.default.span.withConfig({
122
+ displayName: "columns__StyledIdValue",
123
+ componentId: "sc-9f4385-1"
124
+ })(["font-family:", ";white-space:nowrap;font-variant-numeric:tabular-nums;"], SANS);
125
+ /**
126
+ * Same trigger the Date cell uses, so the id gets the identical hover outline
127
+ * and 8px inset — it is a link, not an editor, so it is always visible
128
+ * (`has-value`) rather than appearing on row hover.
129
+ *
130
+ * The typography is Caption 1 bold at every identifier length, like the Date
131
+ * value next to it; long identifiers are handled by the column's width tier,
132
+ * not by shrinking the text.
133
+ */
134
+ var IdTrigger = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
135
+ var value = _ref2.value,
136
+ tooltip = _ref2.tooltip,
137
+ rest = _objectWithoutProperties(_ref2, _excluded2);
138
+ return /*#__PURE__*/_react.default.createElement(StyledListButton, _extends({}, rest, {
139
+ ref: ref,
140
+ className: "show-on-hover has-value",
141
+ "aria-label": "Copy link to task ".concat(value),
142
+ "data-tooltip": tooltip
143
+ }), /*#__PURE__*/_react.default.createElement(StyledIdValue, null, /*#__PURE__*/_react.default.createElement(_Typography.Caption1, {
144
+ weight: "bold",
145
+ color: "secondary"
146
+ }, value)));
147
+ });
148
+ IdTrigger.displayName = "IdTrigger";
149
+
150
+ /**
151
+ * Task identifier cell — the `#<id>` value as a copy-link control, mirroring
152
+ * how `tasks/Metadata.js` turns `Task #248` into the task's Copy Link action:
153
+ * the click writes the task URL to the clipboard and reports back so the page
154
+ * can raise the app's "Link copied to clipboard." toast (utils/copyLinkToClipboard).
155
+ * It never navigates — the row itself is the navigation target.
156
+ */
157
+ var IdentifierCell = exports.IdentifierCell = function IdentifierCell(_ref3) {
158
+ var identifier = _ref3.identifier,
159
+ link = _ref3.link,
160
+ onCopy = _ref3.onCopy;
161
+ var handleClick = (0, _react.useCallback)(function (event) {
162
+ var _navigator$clipboard;
163
+ /* the whole row navigates to the task, so copying must not also open it */
164
+ event.preventDefault();
165
+ event.stopPropagation();
166
+ if ((_navigator$clipboard = navigator.clipboard) !== null && _navigator$clipboard !== void 0 && _navigator$clipboard.writeText) {
167
+ navigator.clipboard.writeText(link).then(function () {
168
+ return onCopy === null || onCopy === void 0 ? void 0 : onCopy(true);
169
+ }).catch(function () {
170
+ return onCopy === null || onCopy === void 0 ? void 0 : onCopy(false);
171
+ });
172
+ return;
173
+ }
174
+ onCopy === null || onCopy === void 0 || onCopy(false);
175
+ }, [link, onCopy]);
176
+ return /*#__PURE__*/_react.default.createElement("div", {
177
+ className: "col col-identifier"
178
+ }, /*#__PURE__*/_react.default.createElement(IdTrigger, {
179
+ value: "#".concat(identifier),
180
+ tooltip: "Copy Link",
181
+ onClick: handleClick
182
+ }));
183
+ };
184
+
110
185
  /* ================================================================== */
111
186
  /* Labels */
112
187
  /* ================================================================== */
@@ -220,8 +295,8 @@ var LabelsContext = /*#__PURE__*/(0, _react.createContext)({
220
295
  * Holds the label catalogue for the whole list, so a label created in one
221
296
  * task's picker shows up in every other picker too.
222
297
  */
223
- var LabelsProvider = exports.LabelsProvider = function LabelsProvider(_ref2) {
224
- var children = _ref2.children;
298
+ var LabelsProvider = exports.LabelsProvider = function LabelsProvider(_ref4) {
299
+ var children = _ref4.children;
225
300
  var _useState = (0, _react.useState)(INITIAL_LABELS),
226
301
  _useState2 = _slicedToArray(_useState, 2),
227
302
  labels = _useState2[0],
@@ -265,15 +340,15 @@ var useTaskLabels = function useTaskLabels() {
265
340
  /* Empty state pill (mirrors EntityLabel + .entity-label in list-view.less) */
266
341
  var StyledLabelPlaceholder = _styledComponents.default.span.withConfig({
267
342
  displayName: "columns__StyledLabelPlaceholder",
268
- componentId: "sc-9f4385-1"
343
+ componentId: "sc-9f4385-2"
269
344
  })(["display:inline-flex;align-items:center;padding:1px 6px;border:1px solid var(--color-theme-700);border-radius:4px;.list-button.open &,.list-button:hover &{border-color:var(--color-primary-700,var(--color-primary));}"]);
270
345
  var StyledLabelItems = _styledComponents.default.span.withConfig({
271
346
  displayName: "columns__StyledLabelItems",
272
- componentId: "sc-9f4385-2"
347
+ componentId: "sc-9f4385-3"
273
348
  })(["display:inline-flex;align-items:center;min-width:0;> *:not(:last-child){margin-right:2px;}.rest-count{margin-left:2px;}", ""], CooltipStyle);
274
349
  var MAX_SHOWN_LABELS = 8;
275
- var LabelItems = function LabelItems(_ref3) {
276
- var labels = _ref3.labels;
350
+ var LabelItems = function LabelItems(_ref5) {
351
+ var labels = _ref5.labels;
277
352
  var showAsDot = labels.length > 2;
278
353
  var shown = labels;
279
354
  var restCount = 0;
@@ -306,9 +381,9 @@ var LabelItems = function LabelItems(_ref3) {
306
381
  className: "rest-count"
307
382
  }, "+", restCount) : null);
308
383
  };
309
- var LabelTrigger = /*#__PURE__*/(0, _react.forwardRef)(function (_ref4, ref) {
310
- var labels = _ref4.labels,
311
- rest = _objectWithoutProperties(_ref4, _excluded2);
384
+ var LabelTrigger = /*#__PURE__*/(0, _react.forwardRef)(function (_ref6, ref) {
385
+ var labels = _ref6.labels,
386
+ rest = _objectWithoutProperties(_ref6, _excluded3);
312
387
  if (labels.length === 0) {
313
388
  return /*#__PURE__*/_react.default.createElement(StyledListButton, _extends({}, rest, {
314
389
  ref: ref,
@@ -328,10 +403,10 @@ var LabelTrigger = /*#__PURE__*/(0, _react.forwardRef)(function (_ref4, ref) {
328
403
  }));
329
404
  });
330
405
  LabelTrigger.displayName = "LabelTrigger";
331
- var LabelCell = exports.LabelCell = function LabelCell(_ref5) {
332
- var labelIds = _ref5.labelIds,
333
- _ref5$completed = _ref5.completed,
334
- completed = _ref5$completed === void 0 ? false : _ref5$completed;
406
+ var LabelCell = exports.LabelCell = function LabelCell(_ref7) {
407
+ var labelIds = _ref7.labelIds,
408
+ _ref7$completed = _ref7.completed,
409
+ completed = _ref7$completed === void 0 ? false : _ref7$completed;
335
410
  var _useTaskLabels = useTaskLabels(),
336
411
  catalog = _useTaskLabels.labels,
337
412
  labelsById = _useTaskLabels.labelsById,
@@ -443,14 +518,14 @@ var isOverdue = exports.isOverdue = function isOverdue(dueOn, completed) {
443
518
  };
444
519
  var StyledDateValue = _styledComponents.default.span.withConfig({
445
520
  displayName: "columns__StyledDateValue",
446
- componentId: "sc-9f4385-3"
521
+ componentId: "sc-9f4385-4"
447
522
  })(["font-family:", ";white-space:nowrap;"], SANS);
448
523
 
449
524
  /* completed rows render values without a trigger, so the cell itself hosts the
450
525
  CSS tooltip */
451
526
  var StyledReadOnlyCell = _styledComponents.default.div.withConfig({
452
527
  displayName: "columns__StyledReadOnlyCell",
453
- componentId: "sc-9f4385-4"
528
+ componentId: "sc-9f4385-5"
454
529
  })(["padding-right:8px;", ""], CooltipStyle);
455
530
 
456
531
  /**
@@ -462,13 +537,13 @@ var StyledReadOnlyCell = _styledComponents.default.div.withConfig({
462
537
  */
463
538
  var StyledPickerCell = _styledComponents.default.div.withConfig({
464
539
  displayName: "columns__StyledPickerCell",
465
- componentId: "sc-9f4385-5"
540
+ componentId: "sc-9f4385-6"
466
541
  })(["> div{text-align:right;}"]);
467
- var DateTrigger = /*#__PURE__*/(0, _react.forwardRef)(function (_ref6, ref) {
468
- var value = _ref6.value,
469
- tooltip = _ref6.tooltip,
470
- overdue = _ref6.overdue,
471
- rest = _objectWithoutProperties(_ref6, _excluded3);
542
+ var DateTrigger = /*#__PURE__*/(0, _react.forwardRef)(function (_ref8, ref) {
543
+ var value = _ref8.value,
544
+ tooltip = _ref8.tooltip,
545
+ overdue = _ref8.overdue,
546
+ rest = _objectWithoutProperties(_ref8, _excluded4);
472
547
  return /*#__PURE__*/_react.default.createElement(StyledListButton, _extends({}, rest, {
473
548
  ref: ref,
474
549
  className: value ? "show-on-hover has-value" : "show-on-hover",
@@ -480,12 +555,12 @@ var DateTrigger = /*#__PURE__*/(0, _react.forwardRef)(function (_ref6, ref) {
480
555
  }, value)) : /*#__PURE__*/_react.default.createElement(_Icons.CalendarIcon, null));
481
556
  });
482
557
  DateTrigger.displayName = "DateTrigger";
483
- var DateCell = exports.DateCell = function DateCell(_ref7) {
558
+ var DateCell = exports.DateCell = function DateCell(_ref9) {
484
559
  var _dates$from, _dates$to2;
485
- var startOn = _ref7.startOn,
486
- dueOn = _ref7.dueOn,
487
- _ref7$completed = _ref7.completed,
488
- completed = _ref7$completed === void 0 ? false : _ref7$completed;
560
+ var startOn = _ref9.startOn,
561
+ dueOn = _ref9.dueOn,
562
+ _ref9$completed = _ref9.completed,
563
+ completed = _ref9$completed === void 0 ? false : _ref9$completed;
489
564
  var _useState5 = (0, _react.useState)({
490
565
  from: startOn,
491
566
  to: dueOn
@@ -616,11 +691,11 @@ var progressColor = function progressColor(percent) {
616
691
  };
617
692
  var StyledTimeValue = _styledComponents.default.span.withConfig({
618
693
  displayName: "columns__StyledTimeValue",
619
- componentId: "sc-9f4385-6"
694
+ componentId: "sc-9f4385-7"
620
695
  })(["display:inline-flex;align-items:center;font-family:", ";white-space:nowrap;.c-progress-pie,svg{flex-shrink:0;}.time-pie{margin-right:8px;}"], SANS);
621
- var TimeValue = function TimeValue(_ref8) {
622
- var tracked = _ref8.tracked,
623
- estimated = _ref8.estimated;
696
+ var TimeValue = function TimeValue(_ref0) {
697
+ var tracked = _ref0.tracked,
698
+ estimated = _ref0.estimated;
624
699
  var percent = timeToEstimatePercentage(tracked, estimated);
625
700
  return /*#__PURE__*/_react.default.createElement(StyledTimeValue, null, estimated > 0 ? /*#__PURE__*/_react.default.createElement(_ProgressPie.ProgressPie, {
626
701
  className: "time-pie",
@@ -632,10 +707,10 @@ var TimeValue = function TimeValue(_ref8) {
632
707
  weight: "bold"
633
708
  }, formatTrackedAndEstimated(tracked, estimated)));
634
709
  };
635
- var TimeTrigger = function TimeTrigger(_ref9) {
636
- var tracked = _ref9.tracked,
637
- estimated = _ref9.estimated,
638
- onClick = _ref9.onClick;
710
+ var TimeTrigger = function TimeTrigger(_ref1) {
711
+ var tracked = _ref1.tracked,
712
+ estimated = _ref1.estimated,
713
+ onClick = _ref1.onClick;
639
714
  var hasTime = tracked > 0 || estimated > 0;
640
715
  return /*#__PURE__*/_react.default.createElement(StyledListButton, {
641
716
  onClick: onClick,
@@ -647,16 +722,16 @@ var TimeTrigger = function TimeTrigger(_ref9) {
647
722
  estimated: estimated
648
723
  }) : /*#__PURE__*/_react.default.createElement(_Icons.ClockAddIcon, null));
649
724
  };
650
- var TimeCell = exports.TimeCell = function TimeCell(_ref0) {
651
- var taskName = _ref0.taskName,
652
- _ref0$tracked = _ref0.tracked,
653
- tracked = _ref0$tracked === void 0 ? 0 : _ref0$tracked,
654
- _ref0$estimated = _ref0.estimated,
655
- estimated = _ref0$estimated === void 0 ? 0 : _ref0$estimated,
656
- users = _ref0.users,
657
- currentUserId = _ref0.currentUserId,
658
- _ref0$completed = _ref0.completed,
659
- completed = _ref0$completed === void 0 ? false : _ref0$completed;
725
+ var TimeCell = exports.TimeCell = function TimeCell(_ref10) {
726
+ var taskName = _ref10.taskName,
727
+ _ref10$tracked = _ref10.tracked,
728
+ tracked = _ref10$tracked === void 0 ? 0 : _ref10$tracked,
729
+ _ref10$estimated = _ref10.estimated,
730
+ estimated = _ref10$estimated === void 0 ? 0 : _ref10$estimated,
731
+ users = _ref10.users,
732
+ currentUserId = _ref10.currentUserId,
733
+ _ref10$completed = _ref10.completed,
734
+ completed = _ref10$completed === void 0 ? false : _ref10$completed;
660
735
  var _useState9 = (0, _react.useState)(false),
661
736
  _useState0 = _slicedToArray(_useState9, 2),
662
737
  open = _useState0[0],
@@ -749,17 +824,17 @@ var JOB_TYPES = [{
749
824
  `Dialog` because it is 770px wide (`.time_record_form_modal_wrapper`). */
750
825
  var StyledTimeRecordPaper = _styledComponents.default.div.withConfig({
751
826
  displayName: "columns__StyledTimeRecordPaper",
752
- componentId: "sc-9f4385-7"
827
+ componentId: "sc-9f4385-8"
753
828
  })(["position:relative;width:770px;max-width:95vw;max-height:calc(100vh - 156px);margin:126px auto 30px auto;padding:20px 30px;overflow:auto;border-radius:8px;background-color:var(--page-paper-main);color:var(--color-theme-900);box-shadow:var(--shadow-primary);box-sizing:border-box;font-family:", ";*{box-sizing:border-box;}@media (max-width:830px){width:calc(100vw - 60px);}.trd-header{display:flex;align-items:center;justify-content:space-between;}.trd-title{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-right:16px;font-size:1rem;font-weight:700;}.trd-date button{width:auto;}.trd-date > div{text-align:right;}.trd-divider{margin:20px 0 32px 0;border-bottom:1px solid var(--border-primary);height:1px;}.trd-body{display:flex;justify-content:space-between;position:relative;}.trd-form{width:100%;}.trd-fields{display:flex;align-items:flex-end;}.trd-hours{width:144px;margin-right:16px;flex-shrink:0;}.trd-hours .c-input-wrapper,.trd-hours input{width:100%;}.trd-field{margin-right:16px;}.trd-field:last-of-type{margin-right:20px;}.trd-field .c-label{display:block;margin-bottom:2px;}.trd-field button{width:144px;}.trd-billable{display:flex;align-items:center;margin-top:24px;}.trd-billable .c-label{margin-left:8px;cursor:pointer;}.trd-description-trigger{display:inline-flex;align-items:center;margin-top:16px;color:var(--color-secondary);font-size:14px;font-weight:500;background:none;border:none;padding:0;cursor:pointer;font-family:", ";}.trd-description-trigger svg{margin-right:4px;fill:var(--color-primary);transition:transform 200ms ease;}.trd-description-trigger.collapsed svg{transform:rotate(180deg);}.trd-textarea{width:360px;max-width:100%;margin-top:8px;font-size:12px;resize:none;}.trd-actions{display:flex;margin-top:24px;}.trd-actions .c-button:first-child{margin-right:12px;}.trd-total{position:absolute;right:0;bottom:0;display:inline-flex;align-items:center;align-self:flex-end;background:none;border:none;padding:0;cursor:pointer;}.trd-total svg{margin-right:4px;fill:var(--color-primary);transition:transform 200ms ease;}.trd-total.collapsed svg{transform:rotate(180deg);}.trd-records{margin-top:32px;border-top:1px solid var(--border-primary);}.trd-record{display:flex;align-items:center;justify-content:space-between;height:36px;border-bottom:1px solid var(--color-theme-300);}.trd-record-left{display:flex;align-items:center;gap:12px;min-width:0;}"], SANS, SANS);
754
- var TimeRecordDialog = function TimeRecordDialog(_ref1) {
755
- var open = _ref1.open,
756
- taskName = _ref1.taskName,
757
- users = _ref1.users,
758
- currentUserId = _ref1.currentUserId,
759
- records = _ref1.records,
760
- total = _ref1.total,
761
- onSubmit = _ref1.onSubmit,
762
- onClose = _ref1.onClose;
829
+ var TimeRecordDialog = function TimeRecordDialog(_ref11) {
830
+ var open = _ref11.open,
831
+ taskName = _ref11.taskName,
832
+ users = _ref11.users,
833
+ currentUserId = _ref11.currentUserId,
834
+ records = _ref11.records,
835
+ total = _ref11.total,
836
+ onSubmit = _ref11.onSubmit,
837
+ onClose = _ref11.onClose;
763
838
  var _useState11 = (0, _react.useState)(""),
764
839
  _useState12 = _slicedToArray(_useState11, 2),
765
840
  value = _useState12[0],