@activecollab/components 2.0.575 → 2.0.577
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.
- package/dist/cjs/components/Popper/Popper.js +14 -0
- package/dist/cjs/components/Popper/Popper.js.map +1 -1
- package/dist/cjs/components/Popper/anchorMove.js +42 -0
- package/dist/cjs/components/Popper/anchorMove.js.map +1 -0
- package/dist/cjs/components/ViewSettings/Styles.js +8 -3
- package/dist/cjs/components/ViewSettings/Styles.js.map +1 -1
- package/dist/cjs/components/ViewSettings/ViewSettings.js +64 -3
- package/dist/cjs/components/ViewSettings/ViewSettings.js.map +1 -1
- package/dist/cjs/components/ViewSwitcher/ApplyToAllTab.js +199 -0
- package/dist/cjs/components/ViewSwitcher/ApplyToAllTab.js.map +1 -0
- package/dist/cjs/components/ViewSwitcher/Styles.js +73 -61
- package/dist/cjs/components/ViewSwitcher/Styles.js.map +1 -1
- package/dist/cjs/components/ViewSwitcher/{ViewSwitcherMenu.js → SubViewSwitcher.js} +70 -22
- package/dist/cjs/components/ViewSwitcher/SubViewSwitcher.js.map +1 -0
- package/dist/cjs/components/ViewSwitcher/ViewSwitcher.js +46 -184
- package/dist/cjs/components/ViewSwitcher/ViewSwitcher.js.map +1 -1
- package/dist/cjs/components/ViewSwitcher/index.js +4 -4
- package/dist/cjs/components/ViewSwitcher/index.js.map +1 -1
- package/dist/cjs/components/ViewSwitcher/useApplyToAllOffer.js +179 -0
- package/dist/cjs/components/ViewSwitcher/useApplyToAllOffer.js.map +1 -0
- package/dist/cjs/presentation/reports/allReports.js +6 -0
- package/dist/cjs/presentation/reports/allReports.js.map +1 -1
- package/dist/cjs/presentation/reports/controls.js +6 -3
- package/dist/cjs/presentation/reports/controls.js.map +1 -1
- package/dist/cjs/presentation/reports/expenses.js +946 -0
- package/dist/cjs/presentation/reports/expenses.js.map +1 -0
- package/dist/cjs/presentation/shared/ActivityFeed.js +1 -2
- package/dist/cjs/presentation/shared/ActivityFeed.js.map +1 -1
- package/dist/esm/components/Popper/Popper.d.ts.map +1 -1
- package/dist/esm/components/Popper/Popper.js +12 -0
- package/dist/esm/components/Popper/Popper.js.map +1 -1
- package/dist/esm/components/Popper/anchorMove.d.ts +4 -0
- package/dist/esm/components/Popper/anchorMove.d.ts.map +1 -0
- package/dist/esm/components/Popper/anchorMove.js +33 -0
- package/dist/esm/components/Popper/anchorMove.js.map +1 -0
- package/dist/esm/components/ViewSettings/Styles.d.ts +1 -0
- package/dist/esm/components/ViewSettings/Styles.d.ts.map +1 -1
- package/dist/esm/components/ViewSettings/Styles.js +7 -2
- package/dist/esm/components/ViewSettings/Styles.js.map +1 -1
- package/dist/esm/components/ViewSettings/ViewSettings.d.ts +12 -0
- package/dist/esm/components/ViewSettings/ViewSettings.d.ts.map +1 -1
- package/dist/esm/components/ViewSettings/ViewSettings.js +66 -5
- package/dist/esm/components/ViewSettings/ViewSettings.js.map +1 -1
- package/dist/esm/components/ViewSwitcher/ApplyToAllTab.d.ts +24 -0
- package/dist/esm/components/ViewSwitcher/ApplyToAllTab.d.ts.map +1 -0
- package/dist/esm/components/ViewSwitcher/ApplyToAllTab.js +179 -0
- package/dist/esm/components/ViewSwitcher/ApplyToAllTab.js.map +1 -0
- package/dist/esm/components/ViewSwitcher/Styles.d.ts +15 -15
- package/dist/esm/components/ViewSwitcher/Styles.d.ts.map +1 -1
- package/dist/esm/components/ViewSwitcher/Styles.js +72 -60
- package/dist/esm/components/ViewSwitcher/Styles.js.map +1 -1
- package/dist/esm/components/ViewSwitcher/SubViewSwitcher.d.ts +50 -0
- package/dist/esm/components/ViewSwitcher/SubViewSwitcher.d.ts.map +1 -0
- package/dist/esm/components/ViewSwitcher/SubViewSwitcher.js +149 -0
- package/dist/esm/components/ViewSwitcher/SubViewSwitcher.js.map +1 -0
- package/dist/esm/components/ViewSwitcher/ViewSwitcher.d.ts +8 -8
- package/dist/esm/components/ViewSwitcher/ViewSwitcher.d.ts.map +1 -1
- package/dist/esm/components/ViewSwitcher/ViewSwitcher.js +48 -163
- package/dist/esm/components/ViewSwitcher/ViewSwitcher.js.map +1 -1
- package/dist/esm/components/ViewSwitcher/index.d.ts +1 -1
- package/dist/esm/components/ViewSwitcher/index.d.ts.map +1 -1
- package/dist/esm/components/ViewSwitcher/index.js +1 -1
- package/dist/esm/components/ViewSwitcher/index.js.map +1 -1
- package/dist/esm/components/ViewSwitcher/useApplyToAllOffer.d.ts +27 -0
- package/dist/esm/components/ViewSwitcher/useApplyToAllOffer.d.ts.map +1 -0
- package/dist/esm/components/ViewSwitcher/useApplyToAllOffer.js +159 -0
- package/dist/esm/components/ViewSwitcher/useApplyToAllOffer.js.map +1 -0
- package/dist/esm/presentation/reports/allReports.d.ts.map +1 -1
- package/dist/esm/presentation/reports/allReports.js +6 -0
- package/dist/esm/presentation/reports/allReports.js.map +1 -1
- package/dist/esm/presentation/reports/controls.d.ts +3 -1
- package/dist/esm/presentation/reports/controls.d.ts.map +1 -1
- package/dist/esm/presentation/reports/controls.js +6 -3
- package/dist/esm/presentation/reports/controls.js.map +1 -1
- package/dist/esm/presentation/reports/expenses.d.ts +62 -0
- package/dist/esm/presentation/reports/expenses.d.ts.map +1 -0
- package/dist/esm/presentation/reports/expenses.js +849 -0
- package/dist/esm/presentation/reports/expenses.js.map +1 -0
- package/dist/esm/presentation/shared/ActivityFeed.d.ts.map +1 -1
- package/dist/esm/presentation/shared/ActivityFeed.js +1 -2
- package/dist/esm/presentation/shared/ActivityFeed.js.map +1 -1
- package/dist/index.js +656 -280
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/components/ViewSwitcher/ViewSwitcherMenu.js.map +0 -1
- package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.d.ts +0 -39
- package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.d.ts.map +0 -1
- package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.js +0 -101
- package/dist/esm/components/ViewSwitcher/ViewSwitcherMenu.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -17276,6 +17276,41 @@
|
|
|
17276
17276
|
};
|
|
17277
17277
|
Overlay.displayName = "Overlay";
|
|
17278
17278
|
|
|
17279
|
+
/** A control that moves its neighbors announces each frame of the move, so an open popper stays at its anchor. */
|
|
17280
|
+
var ANCHOR_MOVE_EVENT = "ac-anchor-move";
|
|
17281
|
+
var MOVE_MS = 320;
|
|
17282
|
+
var announce = function announce() {
|
|
17283
|
+
window.dispatchEvent(new Event(ANCHOR_MOVE_EVENT));
|
|
17284
|
+
};
|
|
17285
|
+
|
|
17286
|
+
// Each frame keeps the popper with its anchor, and a last call after the move settles it where frames come late.
|
|
17287
|
+
var useAnnounceAnchorMove = function useAnnounceAnchorMove(deps) {
|
|
17288
|
+
React.useEffect(function () {
|
|
17289
|
+
var end = performance.now() + MOVE_MS;
|
|
17290
|
+
var frame = 0;
|
|
17291
|
+
var _tick = function tick() {
|
|
17292
|
+
announce();
|
|
17293
|
+
if (performance.now() < end) {
|
|
17294
|
+
frame = requestAnimationFrame(_tick);
|
|
17295
|
+
}
|
|
17296
|
+
};
|
|
17297
|
+
frame = requestAnimationFrame(_tick);
|
|
17298
|
+
var settle = setTimeout(announce, MOVE_MS);
|
|
17299
|
+
return function () {
|
|
17300
|
+
cancelAnimationFrame(frame);
|
|
17301
|
+
clearTimeout(settle);
|
|
17302
|
+
};
|
|
17303
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- the caller names the changes that move it
|
|
17304
|
+
}, deps);
|
|
17305
|
+
|
|
17306
|
+
// The last move ends when the control goes.
|
|
17307
|
+
React.useEffect(function () {
|
|
17308
|
+
return function () {
|
|
17309
|
+
return void setTimeout(announce, 0);
|
|
17310
|
+
};
|
|
17311
|
+
}, []);
|
|
17312
|
+
};
|
|
17313
|
+
|
|
17279
17314
|
var StyledPopper = styled__default["default"]("div").withConfig({
|
|
17280
17315
|
displayName: "Styles__StyledPopper",
|
|
17281
17316
|
componentId: "sc-1hgjasy-0"
|
|
@@ -17402,6 +17437,19 @@
|
|
|
17402
17437
|
return observer.disconnect();
|
|
17403
17438
|
};
|
|
17404
17439
|
}, [anchorEl, followAnchor, open]);
|
|
17440
|
+
React.useEffect(function () {
|
|
17441
|
+
if (!open) {
|
|
17442
|
+
return undefined;
|
|
17443
|
+
}
|
|
17444
|
+
var update = function update() {
|
|
17445
|
+
var _popperRef$current2;
|
|
17446
|
+
return (_popperRef$current2 = popperRef.current) === null || _popperRef$current2 === void 0 ? void 0 : _popperRef$current2.update();
|
|
17447
|
+
};
|
|
17448
|
+
window.addEventListener(ANCHOR_MOVE_EVENT, update);
|
|
17449
|
+
return function () {
|
|
17450
|
+
return window.removeEventListener(ANCHOR_MOVE_EVENT, update);
|
|
17451
|
+
};
|
|
17452
|
+
}, [open]);
|
|
17405
17453
|
React.useEffect(function () {
|
|
17406
17454
|
if (popperRef.current) {
|
|
17407
17455
|
popperRef.current.update();
|
|
@@ -35322,46 +35370,32 @@
|
|
|
35322
35370
|
var StyledViewSettings = styled__default["default"].span.withConfig({
|
|
35323
35371
|
displayName: "Styles__StyledViewSettings",
|
|
35324
35372
|
componentId: "sc-r1diu9-0"
|
|
35325
|
-
})(["", " display:inline-flex;flex-shrink:0;align-items:center;height:32px;padding:3px;border-radius:var(--ac-br-rounded);background-color:var(--color-theme-300);"], BoxSizingStyle);
|
|
35373
|
+
})(["", " display:inline-flex;flex-shrink:0;align-items:center;height:32px;padding:3px;border-radius:var(--ac-br-rounded);background-color:var(--color-theme-300);position:relative;z-index:1;"], BoxSizingStyle);
|
|
35326
35374
|
StyledViewSettings.displayName = "StyledViewSettings";
|
|
35375
|
+
var StyledViewSettingsHost = styled__default["default"].span.withConfig({
|
|
35376
|
+
displayName: "Styles__StyledViewSettingsHost",
|
|
35377
|
+
componentId: "sc-r1diu9-1"
|
|
35378
|
+
})(["", " display:inline-flex;flex-shrink:0;isolation:isolate;"], BoxSizingStyle);
|
|
35379
|
+
StyledViewSettingsHost.displayName = "StyledViewSettingsHost";
|
|
35327
35380
|
var StyledViewSettingsButton = styled__default["default"].button.withConfig({
|
|
35328
35381
|
displayName: "Styles__StyledViewSettingsButton",
|
|
35329
|
-
componentId: "sc-r1diu9-
|
|
35382
|
+
componentId: "sc-r1diu9-2"
|
|
35330
35383
|
})(["", " display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:34px;height:26px;margin:0;padding:0;border:0;border-radius:var(--ac-br-rounded);background-color:transparent;cursor:pointer;outline:none;transition:background-color 150ms ease,box-shadow 150ms ease;svg{width:20px;height:20px;fill:var(--color-theme-700);}&:hover{background-color:color-mix( in srgb,var(--color-theme-900) 16%,transparent );}&[aria-expanded=\"true\"]{background-color:var(--page-paper-main);box-shadow:var(--shadow-float);svg{fill:var(--color-theme-900);}}&:focus-visible{box-shadow:0 0 0 2px var(--color-primary);}"], BoxSizingStyle);
|
|
35331
35384
|
StyledViewSettingsButton.displayName = "StyledViewSettingsButton";
|
|
35332
35385
|
|
|
35333
|
-
var _excluded$14 = ["label", "className"];
|
|
35334
|
-
/** The settings button of a page view, with the look of ViewSwitcher and one icon. It sits left of the view switcher. */
|
|
35335
|
-
var ViewSettings = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
35336
|
-
var label = _ref.label,
|
|
35337
|
-
className = _ref.className,
|
|
35338
|
-
rest = _objectWithoutProperties(_ref, _excluded$14);
|
|
35339
|
-
return /*#__PURE__*/React__default["default"].createElement(StyledViewSettings, {
|
|
35340
|
-
className: classnames__default["default"]("c-view-settings", className),
|
|
35341
|
-
"data-testid": "view-settings"
|
|
35342
|
-
}, /*#__PURE__*/React__default["default"].createElement(Tooltip, {
|
|
35343
|
-
title: label
|
|
35344
|
-
}, /*#__PURE__*/React__default["default"].createElement(StyledViewSettingsButton, _extends({}, rest, {
|
|
35345
|
-
ref: ref,
|
|
35346
|
-
type: "button",
|
|
35347
|
-
"aria-label": label
|
|
35348
|
-
}), /*#__PURE__*/React__default["default"].createElement(SettingsIcon$1, null))));
|
|
35349
|
-
});
|
|
35350
|
-
ViewSettings.displayName = "ViewSettings";
|
|
35351
|
-
|
|
35352
35386
|
var VIEW_SWITCHER_PROMPT_DELAY_MS = 100;
|
|
35353
|
-
var
|
|
35354
|
-
var
|
|
35387
|
+
var VIEW_SWITCHER_APPLIED_MS = 1400;
|
|
35388
|
+
var VIEW_SWITCHER_OPEN_MS = 3000;
|
|
35355
35389
|
var VIEW_SWITCHER_LEAVE_MS = 200;
|
|
35356
35390
|
var StyledViewSwitcher = styled__default["default"].div.withConfig({
|
|
35357
35391
|
displayName: "Styles__StyledViewSwitcher",
|
|
35358
35392
|
componentId: "sc-1cg2mte-0"
|
|
35359
|
-
})(["", " display:inline-flex;flex-shrink:0;"], BoxSizingStyle);
|
|
35393
|
+
})(["", " display:inline-flex;flex-shrink:0;isolation:isolate;"], BoxSizingStyle);
|
|
35360
35394
|
StyledViewSwitcher.displayName = "StyledViewSwitcher";
|
|
35361
35395
|
var StyledViewSwitcherTrack = styled__default["default"].div.withConfig({
|
|
35362
35396
|
displayName: "Styles__StyledViewSwitcherTrack",
|
|
35363
35397
|
componentId: "sc-1cg2mte-1"
|
|
35364
|
-
})(["", " position:relative;display:inline-flex;align-items:center;height:32px;padding:3px;border-radius:var(--ac-br-rounded);background-color:var(--color-theme-300);"], BoxSizingStyle);
|
|
35398
|
+
})(["", " position:relative;display:inline-flex;align-items:center;height:32px;padding:3px;border-radius:var(--ac-br-rounded);background-color:var(--color-theme-300);z-index:1;"], BoxSizingStyle);
|
|
35365
35399
|
StyledViewSwitcherTrack.displayName = "StyledViewSwitcherTrack";
|
|
35366
35400
|
var StyledViewSwitcherOptions = styled__default["default"].div.withConfig({
|
|
35367
35401
|
displayName: "Styles__StyledViewSwitcherOptions",
|
|
@@ -35373,11 +35407,11 @@
|
|
|
35373
35407
|
componentId: "sc-1cg2mte-3"
|
|
35374
35408
|
})(["", " display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:34px;height:26px;margin:0;padding:0;border:0;border-radius:var(--ac-br-rounded);background-color:transparent;cursor:pointer;outline:none;transition:background-color 150ms ease,box-shadow 150ms ease;svg{width:20px;height:20px;fill:var(--color-theme-700);}&:hover{background-color:color-mix( in srgb,var(--color-theme-900) 16%,transparent );}&[aria-checked=\"true\"]{background-color:var(--page-paper-main);box-shadow:var(--shadow-float);cursor:default;svg{fill:var(--color-theme-900);}}&:focus-visible{box-shadow:0 0 0 2px var(--color-primary);}"], BoxSizingStyle);
|
|
35375
35409
|
StyledViewSwitcherOption.displayName = "StyledViewSwitcherOption";
|
|
35376
|
-
var
|
|
35377
|
-
displayName: "
|
|
35410
|
+
var StyledSubViewSwitcherOption = styled__default["default"].button.withConfig({
|
|
35411
|
+
displayName: "Styles__StyledSubViewSwitcherOption",
|
|
35378
35412
|
componentId: "sc-1cg2mte-4"
|
|
35379
|
-
})(["", " display:inline-flex;align-items:center;gap:4px;height:26px;margin:0;padding:0 8px 0 12px;border:0;border-radius:var(--ac-br-rounded);background-color:var(--page-paper-main);box-shadow:var(--shadow-float);color:var(--color-theme-900);font-size:calc(13px * var(--text-scale,1));white-space:nowrap;cursor:pointer;outline:none;svg{flex-shrink:0;fill:var(--color-theme-900);}&:has(.c-view-
|
|
35380
|
-
|
|
35413
|
+
})(["", " display:inline-flex;align-items:center;gap:4px;height:26px;margin:0;padding:0 8px 0 12px;border:0;border-radius:var(--ac-br-rounded);background-color:var(--page-paper-main);box-shadow:var(--shadow-float);color:var(--color-theme-900);font-size:calc(13px * var(--text-scale,1));white-space:nowrap;cursor:pointer;outline:none;svg{flex-shrink:0;fill:var(--color-theme-900);}&:has(.c-sub-view-switcher__icon){padding-left:8px;}.c-sub-view-switcher__values{display:inline-grid;}.c-sub-view-switcher__value{display:inline-flex;grid-area:1 / 1;align-items:center;gap:4px;visibility:hidden;}.c-sub-view-switcher__value[data-selected=\"true\"]{visibility:visible;}.c-sub-view-switcher__icon{display:inline-flex;flex-shrink:0;}.c-sub-view-switcher__icon svg{width:20px;height:20px;}&:focus-visible{box-shadow:0 0 0 2px var(--color-primary);}"], BoxSizingStyle);
|
|
35414
|
+
StyledSubViewSwitcherOption.displayName = "StyledSubViewSwitcherOption";
|
|
35381
35415
|
var VIEW_SWITCHER_MENU_REVEAL_MS = 200;
|
|
35382
35416
|
var VIEW_SWITCHER_MENU_GAP = 8;
|
|
35383
35417
|
var menuReveal = styled.keyframes(["from{grid-template-columns:0fr;margin-right:-", "px;}"], VIEW_SWITCHER_MENU_GAP);
|
|
@@ -35385,87 +35419,517 @@
|
|
|
35385
35419
|
var menuClip = styled.keyframes(["from,to{overflow:hidden;}"]);
|
|
35386
35420
|
|
|
35387
35421
|
// The width opens from nothing, so the controls beside the menu move aside with it.
|
|
35388
|
-
var
|
|
35389
|
-
displayName: "
|
|
35422
|
+
var StyledSubViewSwitcherRoot = styled__default["default"](StyledViewSwitcher).withConfig({
|
|
35423
|
+
displayName: "Styles__StyledSubViewSwitcherRoot",
|
|
35390
35424
|
componentId: "sc-1cg2mte-5"
|
|
35391
|
-
})(["display:inline-grid;grid-template-columns:1fr;&[data-animate-in]{animation:", " ", "ms cubic-bezier(0.4,0,0.2,1);}&[data-animate-in] > .c-view-
|
|
35392
|
-
|
|
35393
|
-
var
|
|
35394
|
-
displayName: "
|
|
35425
|
+
})(["display:inline-grid;grid-template-columns:1fr;&[data-animate-in]{animation:", " ", "ms cubic-bezier(0.4,0,0.2,1);}&[data-animate-in] > .c-sub-view-switcher__clip{animation:", " ", "ms;}&[data-leaving]{pointer-events:none;animation:", " ", "ms cubic-bezier(0.4,0,0.2,1) forwards;}&[data-leaving] > .c-sub-view-switcher__clip{overflow:hidden;}@media (prefers-reduced-motion:reduce){&[data-animate-in],&[data-animate-in] > .c-sub-view-switcher__clip,&[data-leaving]{animation:none;}}"], menuReveal, VIEW_SWITCHER_MENU_REVEAL_MS, menuClip, VIEW_SWITCHER_MENU_REVEAL_MS, menuConceal, VIEW_SWITCHER_MENU_REVEAL_MS);
|
|
35426
|
+
StyledSubViewSwitcherRoot.displayName = "StyledSubViewSwitcherRoot";
|
|
35427
|
+
var StyledSubViewSwitcherClip = styled__default["default"].div.withConfig({
|
|
35428
|
+
displayName: "Styles__StyledSubViewSwitcherClip",
|
|
35395
35429
|
componentId: "sc-1cg2mte-6"
|
|
35396
35430
|
})(["display:flex;min-width:0;> *{flex-shrink:0;}"]);
|
|
35397
|
-
|
|
35398
|
-
var
|
|
35399
|
-
displayName: "
|
|
35431
|
+
StyledSubViewSwitcherClip.displayName = "StyledSubViewSwitcherClip";
|
|
35432
|
+
var StyledSubViewSwitcherIcon = styled__default["default"].span.withConfig({
|
|
35433
|
+
displayName: "Styles__StyledSubViewSwitcherIcon",
|
|
35400
35434
|
componentId: "sc-1cg2mte-7"
|
|
35401
35435
|
})(["display:inline-flex;flex-shrink:0;margin-right:8px;fill:var(--color-theme-900);"]);
|
|
35402
|
-
|
|
35403
|
-
var
|
|
35404
|
-
displayName: "
|
|
35436
|
+
StyledSubViewSwitcherIcon.displayName = "StyledSubViewSwitcherIcon";
|
|
35437
|
+
var StyledSubViewSwitcherList = styled__default["default"](List).withConfig({
|
|
35438
|
+
displayName: "Styles__StyledSubViewSwitcherList",
|
|
35405
35439
|
componentId: "sc-1cg2mte-8"
|
|
35406
35440
|
})(["padding:8px 0;"]);
|
|
35407
|
-
|
|
35408
|
-
var
|
|
35409
|
-
displayName: "
|
|
35441
|
+
StyledSubViewSwitcherList.displayName = "StyledSubViewSwitcherList";
|
|
35442
|
+
var StyledSubViewSwitcherLabel = styled__default["default"].span.withConfig({
|
|
35443
|
+
displayName: "Styles__StyledSubViewSwitcherLabel",
|
|
35410
35444
|
componentId: "sc-1cg2mte-9"
|
|
35411
35445
|
})(["flex:1;&[data-selected=\"true\"]{font-weight:bold;color:var(--color-primary);}"]);
|
|
35412
|
-
|
|
35413
|
-
var promptIn = styled.keyframes(["from{opacity:0;}"]);
|
|
35414
|
-
var promptOut = styled.keyframes(["to{clip-path:inset(0 0 0 100%);}"]);
|
|
35415
|
-
var appliedIn = styled.keyframes(["from{opacity:0;transform:translateY(6px);}"]);
|
|
35416
|
-
var appliedIcon = styled.keyframes(["from{opacity:0;transform:scale(0.4);}60%{transform:scale(1.2);}"]);
|
|
35446
|
+
StyledSubViewSwitcherLabel.displayName = "StyledSubViewSwitcherLabel";
|
|
35417
35447
|
var StyledViewSwitcherPromptTitle = styled__default["default"].span.withConfig({
|
|
35418
35448
|
displayName: "Styles__StyledViewSwitcherPromptTitle",
|
|
35419
35449
|
componentId: "sc-1cg2mte-10"
|
|
35420
35450
|
})(["position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;"]);
|
|
35421
35451
|
StyledViewSwitcherPromptTitle.displayName = "StyledViewSwitcherPromptTitle";
|
|
35422
|
-
var
|
|
35423
|
-
|
|
35424
|
-
|
|
35425
|
-
// The
|
|
35426
|
-
var
|
|
35427
|
-
|
|
35452
|
+
var TAB_EASE = "cubic-bezier(0.4, 0, 0.2, 1)";
|
|
35453
|
+
// The radius of a 32px control.
|
|
35454
|
+
var CONTROL_RADIUS = 16;
|
|
35455
|
+
// The green shows this much around the top and the sides of the control.
|
|
35456
|
+
var TAB_RING = 2;
|
|
35457
|
+
var TAB_RADIUS = CONTROL_RADIUS + TAB_RING;
|
|
35458
|
+
// The buttons sit this far inside the green, so their corners follow its corners.
|
|
35459
|
+
var TAB_INSET = 3;
|
|
35460
|
+
var BUTTON_RADIUS = TAB_RADIUS - TAB_INSET;
|
|
35461
|
+
var slideOut = styled.keyframes(["from{transform:translateY(-100%);}"]);
|
|
35462
|
+
var slideIn = styled.keyframes(["to{transform:translateY(-100%);}"]);
|
|
35463
|
+
var appliedIcon = styled.keyframes(["from{transform:scale(0.3);}60%{transform:scale(1.2);}"]);
|
|
35464
|
+
var doneText = styled.keyframes(["from{opacity:0;transform:translateX(-4px);}"]);
|
|
35465
|
+
|
|
35466
|
+
// The tab rings the control and clips its slide, which comes out from under the control.
|
|
35467
|
+
var StyledApplyToAllTab = styled__default["default"].div.withConfig({
|
|
35468
|
+
displayName: "Styles__StyledApplyToAllTab",
|
|
35428
35469
|
componentId: "sc-1cg2mte-11"
|
|
35429
|
-
})(["", "
|
|
35430
|
-
|
|
35431
|
-
|
|
35432
|
-
|
|
35470
|
+
})(["", " z-index:", ";overflow:hidden;border-radius:", "px;--apply-to-all-fill:#1f9d5a;", " &{--apply-to-all-fill:#2f8f5e;}&[data-phase=\"applying\"],&[data-phase=\"applied\"],&[data-phase=\"leaving\"]{pointer-events:none;}&[data-phase=\"applying\"] .c-apply-to-all__button{opacity:0.7;}.c-apply-to-all__slide{animation:", " ", "ms ", ";}&[data-phase=\"leaving\"] .c-apply-to-all__slide{animation:", " ", "ms ", " forwards;}.c-apply-to-all__label{display:none;}&[data-labeled] .c-apply-to-all__label{display:inline;}&:not([data-labeled]) .c-apply-to-all__done-text{display:none;}@media (prefers-reduced-motion:reduce){.c-apply-to-all__slide,&[data-phase=\"leaving\"] .c-apply-to-all__slide{animation:none;}}"], BoxSizingStyle, layers.house - 1, TAB_RADIUS, DARK_THEME_SELECTOR, slideOut, VIEW_SWITCHER_LEAVE_MS, TAB_EASE, slideIn, VIEW_SWITCHER_LEAVE_MS, TAB_EASE);
|
|
35471
|
+
StyledApplyToAllTab.displayName = "StyledApplyToAllTab";
|
|
35472
|
+
|
|
35473
|
+
// The green part of the tab. Its top sits under the control.
|
|
35474
|
+
var StyledApplyToAllSlide = styled__default["default"].div.withConfig({
|
|
35475
|
+
displayName: "Styles__StyledApplyToAllSlide",
|
|
35433
35476
|
componentId: "sc-1cg2mte-12"
|
|
35434
|
-
})(["display:flex;
|
|
35435
|
-
|
|
35436
|
-
|
|
35437
|
-
|
|
35477
|
+
})(["", " display:flex;align-items:center;padding:calc(var(--apply-to-all-tuck) + ", "px) ", "px ", "px;border-radius:inherit;background-color:var(--apply-to-all-fill);"], BoxSizingStyle, TAB_INSET, TAB_INSET, TAB_INSET);
|
|
35478
|
+
StyledApplyToAllSlide.displayName = "StyledApplyToAllSlide";
|
|
35479
|
+
|
|
35480
|
+
// The apply button takes the room the dismiss button leaves, and only its outer bottom corner is round.
|
|
35481
|
+
var StyledApplyToAllButton = styled__default["default"].button.withConfig({
|
|
35482
|
+
displayName: "Styles__StyledApplyToAllButton",
|
|
35438
35483
|
componentId: "sc-1cg2mte-13"
|
|
35439
|
-
})(["", "
|
|
35440
|
-
|
|
35441
|
-
|
|
35442
|
-
|
|
35484
|
+
})(["", " display:inline-flex;flex:1;align-items:center;justify-content:center;gap:4px;min-width:34px;height:26px;margin:0;padding:0;border:0;border-radius:0 0 0 ", "px;background-color:transparent;color:#fff;font-size:calc(0.75rem * var(--text-scale,1));font-weight:600;white-space:nowrap;cursor:pointer;outline:none;transition:background-color 150ms ease,opacity 150ms ease;svg{flex-shrink:0;width:20px;height:20px;fill:#fff;}&:hover{background-color:color-mix(in srgb,#fff 16%,transparent);}&:focus-visible{box-shadow:inset 0 0 0 2px #fff;}"], BoxSizingStyle, BUTTON_RADIUS);
|
|
35485
|
+
StyledApplyToAllButton.displayName = "StyledApplyToAllButton";
|
|
35486
|
+
|
|
35487
|
+
// The line takes the height of the buttons.
|
|
35488
|
+
var StyledApplyToAllLine = styled__default["default"].i.withConfig({
|
|
35489
|
+
displayName: "Styles__StyledApplyToAllLine",
|
|
35443
35490
|
componentId: "sc-1cg2mte-14"
|
|
35444
|
-
})(["
|
|
35445
|
-
|
|
35446
|
-
var
|
|
35447
|
-
displayName: "
|
|
35491
|
+
})(["flex-shrink:0;width:1px;height:26px;margin:0 1px;background-color:color-mix(in srgb,#fff 35%,transparent);"]);
|
|
35492
|
+
StyledApplyToAllLine.displayName = "StyledApplyToAllLine";
|
|
35493
|
+
var StyledApplyToAllDismiss = styled__default["default"].button.withConfig({
|
|
35494
|
+
displayName: "Styles__StyledApplyToAllDismiss",
|
|
35448
35495
|
componentId: "sc-1cg2mte-15"
|
|
35449
|
-
})(["flex-shrink:0;width:
|
|
35450
|
-
|
|
35451
|
-
|
|
35452
|
-
|
|
35496
|
+
})(["", " display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:26px;height:26px;margin:0;padding:0 2px;border:0;border-radius:0 0 ", "px 0;background-color:transparent;cursor:pointer;outline:none;transition:background-color 150ms ease;svg{width:20px;height:20px;fill:#fff;}&:hover{background-color:color-mix(in srgb,#fff 16%,transparent);}&:focus-visible{box-shadow:inset 0 0 0 2px #fff;}"], BoxSizingStyle, BUTTON_RADIUS);
|
|
35497
|
+
StyledApplyToAllDismiss.displayName = "StyledApplyToAllDismiss";
|
|
35498
|
+
|
|
35499
|
+
// The confirmation takes the place of the buttons, at the size of the tab.
|
|
35500
|
+
var StyledApplyToAllDone = styled__default["default"].span.withConfig({
|
|
35501
|
+
displayName: "Styles__StyledApplyToAllDone",
|
|
35453
35502
|
componentId: "sc-1cg2mte-16"
|
|
35454
|
-
})(["", " display:inline-flex;flex
|
|
35455
|
-
|
|
35456
|
-
|
|
35457
|
-
|
|
35458
|
-
|
|
35459
|
-
|
|
35460
|
-
|
|
35503
|
+
})(["", " display:inline-flex;flex:1;align-items:center;justify-content:center;gap:4px;height:26px;overflow:hidden;color:#fff;font-size:calc(0.75rem * var(--text-scale,1));font-weight:600;white-space:nowrap;svg{flex-shrink:0;width:18px;height:18px;fill:currentColor;animation:", " 320ms cubic-bezier(0.34,1.56,0.64,1);}.c-apply-to-all__done-text{animation:", " 220ms ", " 80ms backwards;}@media (prefers-reduced-motion:reduce){svg,.c-apply-to-all__done-text{animation:none;}}"], BoxSizingStyle, appliedIcon, doneText, TAB_EASE);
|
|
35504
|
+
StyledApplyToAllDone.displayName = "StyledApplyToAllDone";
|
|
35505
|
+
|
|
35506
|
+
// A control at least this wide gives the apply button room for its text.
|
|
35507
|
+
var LABEL_ROOM = 120;
|
|
35508
|
+
// The outline of the tab with a hole in the shape of the control, so the control shows on top of it.
|
|
35509
|
+
var controlHole = function controlHole(width, height, hole) {
|
|
35510
|
+
var r = Math.min(hole.height, hole.width) / 2;
|
|
35511
|
+
var left = hole.x + r;
|
|
35512
|
+
var right = hole.x + hole.width - r;
|
|
35513
|
+
var bottom = hole.y + hole.height;
|
|
35514
|
+
return "path(evenodd, \"M0 0H".concat(width, "V").concat(height, "H0Z M").concat(left, " ").concat(hole.y, "H").concat(right, "A").concat(r, " ").concat(r, " 0 0 1 ").concat(right, " ").concat(bottom, "H").concat(left, "A").concat(r, " ").concat(r, " 0 0 1 ").concat(left, " ").concat(hole.y, "Z\")");
|
|
35515
|
+
};
|
|
35516
|
+
|
|
35517
|
+
// The tab draws on top of the page, so neither the titlebar nor the paper under it cut it. It wraps the control with a
|
|
35518
|
+
// thin ring, and a hole in the shape of the control keeps the control in front. A tab is wider only when its buttons
|
|
35519
|
+
// need the room.
|
|
35520
|
+
var usePlace = function usePlace(isConfirmed) {
|
|
35521
|
+
var _keptRef$current;
|
|
35522
|
+
var markerRef = React.useRef(null);
|
|
35523
|
+
var tabRef = React.useRef(null);
|
|
35524
|
+
var _useState = React.useState(null),
|
|
35525
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35526
|
+
place = _useState2[0],
|
|
35527
|
+
setPlace = _useState2[1];
|
|
35528
|
+
// The confirmation keeps the size and the shape of the tab it replaces.
|
|
35529
|
+
var keptRef = React.useRef(null);
|
|
35530
|
+
var isConfirmedRef = React.useRef(isConfirmed);
|
|
35531
|
+
isConfirmedRef.current = isConfirmed;
|
|
35532
|
+
React.useLayoutEffect(function () {
|
|
35533
|
+
var _markerRef$current;
|
|
35534
|
+
var control = (_markerRef$current = markerRef.current) === null || _markerRef$current === void 0 ? void 0 : _markerRef$current.parentElement;
|
|
35535
|
+
if (!control) {
|
|
35536
|
+
return undefined;
|
|
35537
|
+
}
|
|
35538
|
+
var measure = function measure() {
|
|
35539
|
+
var _ref, _kept$width, _tabRef$current, _tabRef$current$offse, _tabRef$current2, _kept$isWrapping;
|
|
35540
|
+
var rect = control.getBoundingClientRect();
|
|
35541
|
+
var kept = isConfirmedRef.current ? keptRef.current : null;
|
|
35542
|
+
var width = (_ref = (_kept$width = kept === null || kept === void 0 ? void 0 : kept.width) !== null && _kept$width !== void 0 ? _kept$width : (_tabRef$current = tabRef.current) === null || _tabRef$current === void 0 ? void 0 : _tabRef$current.offsetWidth) !== null && _ref !== void 0 ? _ref : 0;
|
|
35543
|
+
var height = (_tabRef$current$offse = (_tabRef$current2 = tabRef.current) === null || _tabRef$current2 === void 0 ? void 0 : _tabRef$current2.offsetHeight) !== null && _tabRef$current$offse !== void 0 ? _tabRef$current$offse : 0;
|
|
35544
|
+
var isWrapping = (_kept$isWrapping = kept === null || kept === void 0 ? void 0 : kept.isWrapping) !== null && _kept$isWrapping !== void 0 ? _kept$isWrapping : width > rect.width + 2 * TAB_RING + 0.5;
|
|
35545
|
+
if (!isConfirmedRef.current) {
|
|
35546
|
+
keptRef.current = {
|
|
35547
|
+
width,
|
|
35548
|
+
isWrapping
|
|
35549
|
+
};
|
|
35550
|
+
}
|
|
35551
|
+
var tuck = rect.height + TAB_RING;
|
|
35552
|
+
setPlace({
|
|
35553
|
+
top: rect.bottom - tuck,
|
|
35554
|
+
left: rect.left + rect.width / 2,
|
|
35555
|
+
minWidth: kept ? width : rect.width + 2 * TAB_RING,
|
|
35556
|
+
width: kept ? width : undefined,
|
|
35557
|
+
isLabeled: !isWrapping && rect.width >= LABEL_ROOM,
|
|
35558
|
+
tuck,
|
|
35559
|
+
clipPath: width && height ? controlHole(width, height, {
|
|
35560
|
+
x: (width - rect.width) / 2,
|
|
35561
|
+
y: TAB_RING,
|
|
35562
|
+
width: rect.width,
|
|
35563
|
+
height: rect.height
|
|
35564
|
+
}) : undefined
|
|
35565
|
+
});
|
|
35566
|
+
};
|
|
35567
|
+
measure();
|
|
35568
|
+
// The width of the tab is known after its first draw.
|
|
35569
|
+
var frame = requestAnimationFrame(measure);
|
|
35570
|
+
window.addEventListener("resize", measure);
|
|
35571
|
+
window.addEventListener("scroll", measure, true);
|
|
35572
|
+
window.addEventListener(ANCHOR_MOVE_EVENT, measure);
|
|
35573
|
+
return function () {
|
|
35574
|
+
cancelAnimationFrame(frame);
|
|
35575
|
+
window.removeEventListener("resize", measure);
|
|
35576
|
+
window.removeEventListener("scroll", measure, true);
|
|
35577
|
+
window.removeEventListener(ANCHOR_MOVE_EVENT, measure);
|
|
35578
|
+
};
|
|
35579
|
+
}, []);
|
|
35461
35580
|
|
|
35462
|
-
|
|
35581
|
+
// The kept width applies in the same draw as the confirmation, before a new measure.
|
|
35582
|
+
var keptWidth = isConfirmed ? (_keptRef$current = keptRef.current) === null || _keptRef$current === void 0 ? void 0 : _keptRef$current.width : undefined;
|
|
35583
|
+
return {
|
|
35584
|
+
markerRef,
|
|
35585
|
+
tabRef,
|
|
35586
|
+
place,
|
|
35587
|
+
keptWidth
|
|
35588
|
+
};
|
|
35589
|
+
};
|
|
35590
|
+
/** The extension that comes out from under a view control and applies its value to all projects. */
|
|
35591
|
+
var ApplyToAllTab = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
35592
|
+
var _place$tuck;
|
|
35593
|
+
var phase = _ref2.phase,
|
|
35594
|
+
isConfirmed = _ref2.isConfirmed,
|
|
35595
|
+
title = _ref2.title,
|
|
35596
|
+
label = _ref2.label,
|
|
35597
|
+
appliedLabel = _ref2.appliedLabel,
|
|
35598
|
+
onApply = _ref2.onApply,
|
|
35599
|
+
_ref2$applyToAllLabel = _ref2.applyToAllLabel,
|
|
35600
|
+
applyToAllLabel = _ref2$applyToAllLabel === void 0 ? "All Projects?" : _ref2$applyToAllLabel,
|
|
35601
|
+
_ref2$dismissLabel = _ref2.dismissLabel,
|
|
35602
|
+
dismissLabel = _ref2$dismissLabel === void 0 ? "Dismiss" : _ref2$dismissLabel,
|
|
35603
|
+
onDismiss = _ref2.onDismiss,
|
|
35604
|
+
onHold = _ref2.onHold;
|
|
35605
|
+
var labelId = React.useId();
|
|
35606
|
+
var _usePlace = usePlace(isConfirmed),
|
|
35607
|
+
markerRef = _usePlace.markerRef,
|
|
35608
|
+
tabRef = _usePlace.tabRef,
|
|
35609
|
+
place = _usePlace.place,
|
|
35610
|
+
keptWidth = _usePlace.keptWidth;
|
|
35611
|
+
var handleRef = useForkRef(tabRef, ref);
|
|
35612
|
+
|
|
35613
|
+
// The tab grows and shrinks beside the controls, so it moves the ones before it.
|
|
35614
|
+
useAnnounceAnchorMove([phase, isConfirmed]);
|
|
35615
|
+
var style = {
|
|
35616
|
+
top: place === null || place === void 0 ? void 0 : place.top,
|
|
35617
|
+
left: place === null || place === void 0 ? void 0 : place.left,
|
|
35618
|
+
minWidth: keptWidth !== null && keptWidth !== void 0 ? keptWidth : place === null || place === void 0 ? void 0 : place.minWidth,
|
|
35619
|
+
width: keptWidth !== null && keptWidth !== void 0 ? keptWidth : place === null || place === void 0 ? void 0 : place.width,
|
|
35620
|
+
clipPath: place === null || place === void 0 ? void 0 : place.clipPath,
|
|
35621
|
+
position: "fixed",
|
|
35622
|
+
translate: "-50% 0",
|
|
35623
|
+
visibility: place ? undefined : "hidden",
|
|
35624
|
+
"--apply-to-all-tuck": "".concat((_place$tuck = place === null || place === void 0 ? void 0 : place.tuck) !== null && _place$tuck !== void 0 ? _place$tuck : 32 + TAB_RING, "px")
|
|
35625
|
+
};
|
|
35626
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
35627
|
+
ref: markerRef,
|
|
35628
|
+
hidden: true
|
|
35629
|
+
}), /*#__PURE__*/React__default["default"].createElement(Portal, null, /*#__PURE__*/React__default["default"].createElement(StyledApplyToAllTab, {
|
|
35630
|
+
ref: handleRef,
|
|
35631
|
+
style: style,
|
|
35632
|
+
role: "group",
|
|
35633
|
+
"aria-labelledby": label ? labelId : undefined,
|
|
35634
|
+
"aria-label": label ? undefined : title,
|
|
35635
|
+
className: "c-apply-to-all",
|
|
35636
|
+
"data-phase": phase,
|
|
35637
|
+
"data-confirmed": isConfirmed || undefined,
|
|
35638
|
+
"data-labeled": (place === null || place === void 0 ? void 0 : place.isLabeled) || undefined
|
|
35639
|
+
// A menu that opens on a click around its control must not open from the tab.
|
|
35640
|
+
,
|
|
35641
|
+
onClick: function onClick(event) {
|
|
35642
|
+
return event.stopPropagation();
|
|
35643
|
+
},
|
|
35644
|
+
onPointerEnter: function onPointerEnter() {
|
|
35645
|
+
return onHold === null || onHold === void 0 ? void 0 : onHold(true);
|
|
35646
|
+
},
|
|
35647
|
+
onPointerLeave: function onPointerLeave() {
|
|
35648
|
+
return onHold === null || onHold === void 0 ? void 0 : onHold(false);
|
|
35649
|
+
}
|
|
35650
|
+
}, label ? /*#__PURE__*/React__default["default"].createElement(StyledViewSwitcherPromptTitle, {
|
|
35651
|
+
id: labelId
|
|
35652
|
+
}, label) : null, /*#__PURE__*/React__default["default"].createElement(StyledApplyToAllSlide, {
|
|
35653
|
+
className: "c-apply-to-all__slide"
|
|
35654
|
+
}, isConfirmed ? /*#__PURE__*/React__default["default"].createElement(StyledApplyToAllDone, {
|
|
35655
|
+
role: "status",
|
|
35656
|
+
className: "c-apply-to-all__done"
|
|
35657
|
+
}, /*#__PURE__*/React__default["default"].createElement(CheckIcon$1, null), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
35658
|
+
className: "c-apply-to-all__done-text"
|
|
35659
|
+
}, appliedLabel)) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Tooltip, {
|
|
35660
|
+
title: title,
|
|
35661
|
+
placement: "bottom"
|
|
35662
|
+
}, /*#__PURE__*/React__default["default"].createElement(StyledApplyToAllButton, {
|
|
35663
|
+
type: "button",
|
|
35664
|
+
"aria-label": title,
|
|
35665
|
+
className: "c-apply-to-all__button",
|
|
35666
|
+
onClick: onApply
|
|
35667
|
+
}, /*#__PURE__*/React__default["default"].createElement(CheckIcon$1, null), /*#__PURE__*/React__default["default"].createElement("span", {
|
|
35668
|
+
className: "c-apply-to-all__label",
|
|
35669
|
+
"aria-hidden": true
|
|
35670
|
+
}, applyToAllLabel))), onDismiss ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(StyledApplyToAllLine, {
|
|
35671
|
+
className: "c-apply-to-all__line"
|
|
35672
|
+
}), /*#__PURE__*/React__default["default"].createElement(Tooltip, {
|
|
35673
|
+
title: dismissLabel,
|
|
35674
|
+
placement: "bottom"
|
|
35675
|
+
}, /*#__PURE__*/React__default["default"].createElement(StyledApplyToAllDismiss, {
|
|
35676
|
+
type: "button",
|
|
35677
|
+
"aria-label": dismissLabel,
|
|
35678
|
+
className: "c-apply-to-all__dismiss",
|
|
35679
|
+
onClick: onDismiss
|
|
35680
|
+
}, /*#__PURE__*/React__default["default"].createElement(CloseIcon$1, null)))) : null)))));
|
|
35681
|
+
});
|
|
35682
|
+
ApplyToAllTab.displayName = "ApplyToAllTab";
|
|
35683
|
+
|
|
35684
|
+
// A choice in an open DS menu does not close the offer, and the first click outside only closes the menu.
|
|
35685
|
+
var isInMenu = function isInMenu(node) {
|
|
35686
|
+
var _node$parentElement;
|
|
35687
|
+
return node instanceof Element && (Boolean(node.closest(".c-simple-menu__paper")) || node.classList.contains("c-overlay") && Boolean((_node$parentElement = node.parentElement) === null || _node$parentElement === void 0 ? void 0 : _node$parentElement.querySelector(".c-simple-menu__paper")));
|
|
35688
|
+
};
|
|
35689
|
+
/** The state of the apply to all offer beside a view control: it opens after a change and closes on a click outside. */
|
|
35690
|
+
var useApplyToAllOffer = function useApplyToAllOffer(_ref) {
|
|
35691
|
+
var rootRef = _ref.rootRef,
|
|
35692
|
+
onApplyToAll = _ref.onApplyToAll,
|
|
35693
|
+
onRestoreFocus = _ref.onRestoreFocus;
|
|
35694
|
+
var _useState = React.useState(null),
|
|
35695
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35696
|
+
offer = _useState2[0],
|
|
35697
|
+
setOffer = _useState2[1];
|
|
35698
|
+
var _useState3 = React.useState("waiting"),
|
|
35699
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
35700
|
+
phase = _useState4[0],
|
|
35701
|
+
setPhase = _useState4[1];
|
|
35702
|
+
var _useState5 = React.useState(false),
|
|
35703
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
35704
|
+
isConfirmed = _useState6[0],
|
|
35705
|
+
setIsConfirmed = _useState6[1];
|
|
35706
|
+
var _useState7 = React.useState(false),
|
|
35707
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
35708
|
+
isHeld = _useState8[0],
|
|
35709
|
+
setIsHeld = _useState8[1];
|
|
35710
|
+
var tabRef = React.useRef(null);
|
|
35711
|
+
var offerRef = React.useRef(offer);
|
|
35712
|
+
var phaseRef = React.useRef(phase);
|
|
35713
|
+
var restoreFocusRef = React.useRef(false);
|
|
35714
|
+
offerRef.current = offer;
|
|
35715
|
+
phaseRef.current = phase;
|
|
35716
|
+
var isUp = Boolean(offer) && ["open", "applying", "applied"].includes(phase);
|
|
35717
|
+
var show = React.useCallback(function (value) {
|
|
35718
|
+
if (!onApplyToAll) {
|
|
35719
|
+
return;
|
|
35720
|
+
}
|
|
35721
|
+
|
|
35722
|
+
// An open offer stays for the next change, and only a new one waits.
|
|
35723
|
+
setPhase(function (current) {
|
|
35724
|
+
return offerRef.current && current === "open" ? "open" : "waiting";
|
|
35725
|
+
});
|
|
35726
|
+
setIsConfirmed(false);
|
|
35727
|
+
setOffer({
|
|
35728
|
+
value
|
|
35729
|
+
});
|
|
35730
|
+
}, [onApplyToAll]);
|
|
35731
|
+
var leave = React.useCallback(function () {
|
|
35732
|
+
var _tabRef$current;
|
|
35733
|
+
restoreFocusRef.current = Boolean((_tabRef$current = tabRef.current) === null || _tabRef$current === void 0 ? void 0 : _tabRef$current.contains(document.activeElement));
|
|
35734
|
+
if (phaseRef.current === "waiting") {
|
|
35735
|
+
setOffer(null);
|
|
35736
|
+
return;
|
|
35737
|
+
}
|
|
35738
|
+
setPhase("leaving");
|
|
35739
|
+
}, []);
|
|
35740
|
+
React.useEffect(function () {
|
|
35741
|
+
if (!offer && restoreFocusRef.current) {
|
|
35742
|
+
restoreFocusRef.current = false;
|
|
35743
|
+
onRestoreFocus();
|
|
35744
|
+
}
|
|
35745
|
+
}, [offer, onRestoreFocus]);
|
|
35746
|
+
React.useEffect(function () {
|
|
35747
|
+
// The offer goes by itself, but not while the pointer is over it.
|
|
35748
|
+
if (!offer || phase === "applying" || phase === "open" && isHeld) {
|
|
35749
|
+
return undefined;
|
|
35750
|
+
}
|
|
35751
|
+
var timer = setTimeout(function () {
|
|
35752
|
+
if (phase === "waiting") {
|
|
35753
|
+
setPhase("open");
|
|
35754
|
+
} else if (phase === "open" || phase === "applied") {
|
|
35755
|
+
leave();
|
|
35756
|
+
} else {
|
|
35757
|
+
setIsHeld(false);
|
|
35758
|
+
setOffer(null);
|
|
35759
|
+
}
|
|
35760
|
+
}, phase === "waiting" ? VIEW_SWITCHER_PROMPT_DELAY_MS : phase === "open" ? VIEW_SWITCHER_OPEN_MS : phase === "applied" ? VIEW_SWITCHER_APPLIED_MS : VIEW_SWITCHER_LEAVE_MS);
|
|
35761
|
+
return function () {
|
|
35762
|
+
return clearTimeout(timer);
|
|
35763
|
+
};
|
|
35764
|
+
}, [isHeld, leave, offer, phase]);
|
|
35765
|
+
var isOwn = React.useCallback(function (node) {
|
|
35766
|
+
var _rootRef$current, _tabRef$current2;
|
|
35767
|
+
return Boolean(node && (((_rootRef$current = rootRef.current) === null || _rootRef$current === void 0 ? void 0 : _rootRef$current.contains(node)) || ((_tabRef$current2 = tabRef.current) === null || _tabRef$current2 === void 0 ? void 0 : _tabRef$current2.contains(node)))) || isInMenu(node);
|
|
35768
|
+
}, [rootRef]);
|
|
35769
|
+
var isPressingRef = React.useRef(false);
|
|
35770
|
+
React.useEffect(function () {
|
|
35771
|
+
if (!offer) {
|
|
35772
|
+
return undefined;
|
|
35773
|
+
}
|
|
35774
|
+
var press = function press() {
|
|
35775
|
+
isPressingRef.current = true;
|
|
35776
|
+
};
|
|
35777
|
+
var leaveOutside = function leaveOutside(event) {
|
|
35778
|
+
isPressingRef.current = false;
|
|
35779
|
+
var target = event.target;
|
|
35780
|
+
if (isOwn(target)) {
|
|
35781
|
+
return;
|
|
35782
|
+
}
|
|
35783
|
+
leave();
|
|
35784
|
+
};
|
|
35785
|
+
document.addEventListener("pointerdown", press, true);
|
|
35786
|
+
document.addEventListener("click", leaveOutside, true);
|
|
35787
|
+
return function () {
|
|
35788
|
+
document.removeEventListener("pointerdown", press, true);
|
|
35789
|
+
document.removeEventListener("click", leaveOutside, true);
|
|
35790
|
+
};
|
|
35791
|
+
}, [isOwn, leave, offer]);
|
|
35792
|
+
var handleKeyDown = function handleKeyDown(event) {
|
|
35793
|
+
if (event.key !== "Escape" || !offer) {
|
|
35794
|
+
return;
|
|
35795
|
+
}
|
|
35796
|
+
if (phase !== "waiting") {
|
|
35797
|
+
// A native dialog around the control would take an Escape that is not prevented as its own close request.
|
|
35798
|
+
event.preventDefault();
|
|
35799
|
+
event.stopPropagation();
|
|
35800
|
+
}
|
|
35801
|
+
leave();
|
|
35802
|
+
};
|
|
35803
|
+
var handleBlur = function handleBlur(event) {
|
|
35804
|
+
var next = event.relatedTarget;
|
|
35805
|
+
|
|
35806
|
+
// A press moves the focus first, and the click that follows decides.
|
|
35807
|
+
if (offer && next && !isOwn(next) && !isPressingRef.current) {
|
|
35808
|
+
leave();
|
|
35809
|
+
}
|
|
35810
|
+
};
|
|
35811
|
+
var apply = async function apply() {
|
|
35812
|
+
var _tabRef$current3;
|
|
35813
|
+
var current = offer;
|
|
35814
|
+
if (!current || !onApplyToAll || phase !== "open") {
|
|
35815
|
+
return;
|
|
35816
|
+
}
|
|
35817
|
+
var isApplied = false;
|
|
35818
|
+
|
|
35819
|
+
// The button stops taking clicks while it confirms, so the focus goes back to the control now.
|
|
35820
|
+
if ((_tabRef$current3 = tabRef.current) !== null && _tabRef$current3 !== void 0 && _tabRef$current3.contains(document.activeElement)) {
|
|
35821
|
+
onRestoreFocus();
|
|
35822
|
+
}
|
|
35823
|
+
setPhase("applying");
|
|
35824
|
+
try {
|
|
35825
|
+
isApplied = (await onApplyToAll(current.value)) !== false;
|
|
35826
|
+
} finally {
|
|
35827
|
+
if (offerRef.current === current) {
|
|
35828
|
+
setIsConfirmed(isApplied);
|
|
35829
|
+
setPhase(isApplied ? "applied" : "leaving");
|
|
35830
|
+
}
|
|
35831
|
+
}
|
|
35832
|
+
};
|
|
35833
|
+
return {
|
|
35834
|
+
offer,
|
|
35835
|
+
phase,
|
|
35836
|
+
isUp,
|
|
35837
|
+
isConfirmed,
|
|
35838
|
+
hold: setIsHeld,
|
|
35839
|
+
isShown: Boolean(offer) && phase !== "waiting",
|
|
35840
|
+
tabRef,
|
|
35841
|
+
show,
|
|
35842
|
+
leave,
|
|
35843
|
+
apply,
|
|
35844
|
+
handleKeyDown,
|
|
35845
|
+
handleBlur
|
|
35846
|
+
};
|
|
35847
|
+
};
|
|
35848
|
+
|
|
35849
|
+
var _excluded$14 = ["label", "className", "onApplyToAll", "offerKey", "applyToAllTitle", "appliedLabel", "applyToAllLabel", "dismissLabel"];
|
|
35850
|
+
/** The settings button of a page view, with the look of ViewSwitcher and one icon. It sits left of the view switcher. */
|
|
35851
|
+
var ViewSettings = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
35852
|
+
var label = _ref.label,
|
|
35853
|
+
className = _ref.className,
|
|
35854
|
+
onApplyToAll = _ref.onApplyToAll,
|
|
35855
|
+
offerKey = _ref.offerKey,
|
|
35856
|
+
_ref$applyToAllTitle = _ref.applyToAllTitle,
|
|
35857
|
+
applyToAllTitle = _ref$applyToAllTitle === void 0 ? "Apply to All Projects" : _ref$applyToAllTitle,
|
|
35858
|
+
_ref$appliedLabel = _ref.appliedLabel,
|
|
35859
|
+
appliedLabel = _ref$appliedLabel === void 0 ? "Applied" : _ref$appliedLabel,
|
|
35860
|
+
_ref$applyToAllLabel = _ref.applyToAllLabel,
|
|
35861
|
+
applyToAllLabel = _ref$applyToAllLabel === void 0 ? "All Projects?" : _ref$applyToAllLabel,
|
|
35862
|
+
_ref$dismissLabel = _ref.dismissLabel,
|
|
35863
|
+
dismissLabel = _ref$dismissLabel === void 0 ? "Dismiss" : _ref$dismissLabel,
|
|
35864
|
+
rest = _objectWithoutProperties(_ref, _excluded$14);
|
|
35865
|
+
var hostRef = React.useRef(null);
|
|
35866
|
+
var buttonRef = React.useRef(null);
|
|
35867
|
+
var handleButtonRef = useForkRef(buttonRef, ref);
|
|
35868
|
+
var focusButton = React.useCallback(function () {
|
|
35869
|
+
var _buttonRef$current;
|
|
35870
|
+
return (_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 ? void 0 : _buttonRef$current.focus();
|
|
35871
|
+
}, []);
|
|
35872
|
+
var offer = useApplyToAllOffer({
|
|
35873
|
+
rootRef: hostRef,
|
|
35874
|
+
onApplyToAll,
|
|
35875
|
+
onRestoreFocus: focusButton
|
|
35876
|
+
});
|
|
35877
|
+
var show = offer.show;
|
|
35878
|
+
var seenOfferKeyRef = React.useRef(offerKey);
|
|
35879
|
+
var hasChangeRef = React.useRef(false);
|
|
35880
|
+
var expanded = rest["aria-expanded"];
|
|
35881
|
+
var isMenuOpen = expanded === true || expanded === "true";
|
|
35882
|
+
|
|
35883
|
+
// A change made in the open menu offers the apply once the menu closes.
|
|
35884
|
+
React.useEffect(function () {
|
|
35885
|
+
if (seenOfferKeyRef.current !== offerKey) {
|
|
35886
|
+
seenOfferKeyRef.current = offerKey;
|
|
35887
|
+
hasChangeRef.current = true;
|
|
35888
|
+
}
|
|
35889
|
+
if (hasChangeRef.current && !isMenuOpen) {
|
|
35890
|
+
hasChangeRef.current = false;
|
|
35891
|
+
show(true);
|
|
35892
|
+
}
|
|
35893
|
+
}, [isMenuOpen, offerKey, show]);
|
|
35894
|
+
var track = /*#__PURE__*/React__default["default"].createElement(StyledViewSettings, {
|
|
35895
|
+
className: classnames__default["default"]("c-view-settings", className),
|
|
35896
|
+
"data-testid": "view-settings"
|
|
35897
|
+
}, /*#__PURE__*/React__default["default"].createElement(Tooltip, {
|
|
35898
|
+
title: label
|
|
35899
|
+
}, /*#__PURE__*/React__default["default"].createElement(StyledViewSettingsButton, _extends({}, rest, {
|
|
35900
|
+
ref: handleButtonRef,
|
|
35901
|
+
type: "button",
|
|
35902
|
+
"aria-label": label
|
|
35903
|
+
}), /*#__PURE__*/React__default["default"].createElement(SettingsIcon$1, null))));
|
|
35904
|
+
if (!onApplyToAll) {
|
|
35905
|
+
return track;
|
|
35906
|
+
}
|
|
35907
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledViewSettingsHost, {
|
|
35908
|
+
ref: hostRef,
|
|
35909
|
+
onKeyDown: offer.handleKeyDown,
|
|
35910
|
+
onBlur: offer.handleBlur
|
|
35911
|
+
}, track, offer.isShown ? /*#__PURE__*/React__default["default"].createElement(ApplyToAllTab, {
|
|
35912
|
+
ref: offer.tabRef,
|
|
35913
|
+
phase: offer.phase,
|
|
35914
|
+
isConfirmed: offer.isConfirmed,
|
|
35915
|
+
title: applyToAllTitle,
|
|
35916
|
+
appliedLabel: appliedLabel,
|
|
35917
|
+
onApply: offer.apply,
|
|
35918
|
+
onDismiss: offer.leave,
|
|
35919
|
+
onHold: offer.hold,
|
|
35920
|
+
dismissLabel: dismissLabel,
|
|
35921
|
+
applyToAllLabel: applyToAllLabel
|
|
35922
|
+
}) : null);
|
|
35923
|
+
});
|
|
35924
|
+
ViewSettings.displayName = "ViewSettings";
|
|
35925
|
+
|
|
35926
|
+
var _excluded$13 = ["views", "value", "onChange", "aria-label", "onApplyToAll", "applyToAllTitle", "offerTitle", "appliedLabel", "applyToAllLabel", "dismissLabel", "offerKey", "className", "onKeyDown", "onBlur"];
|
|
35463
35927
|
/**
|
|
35464
35928
|
* @component ViewSwitcher
|
|
35465
35929
|
* @description
|
|
35466
|
-
*
|
|
35467
|
-
* With onApplyToAll, a switch or a click on the checked view
|
|
35468
|
-
* after a short delay,
|
|
35930
|
+
* The main view switcher: an icon-only radiogroup that switches the view of a page. A tooltip shows the view name on hover.
|
|
35931
|
+
* With onApplyToAll, a switch or a click on the checked view slides a check button out from under the right end
|
|
35932
|
+
* after a short delay. It applies the view to all projects, and a click outside closes it.
|
|
35469
35933
|
*
|
|
35470
35934
|
* @example
|
|
35471
35935
|
* <ViewSwitcher
|
|
@@ -35487,15 +35951,15 @@
|
|
|
35487
35951
|
_ref$ariaLabel = _ref["aria-label"],
|
|
35488
35952
|
ariaLabel = _ref$ariaLabel === void 0 ? "View" : _ref$ariaLabel,
|
|
35489
35953
|
onApplyToAll = _ref.onApplyToAll,
|
|
35490
|
-
_ref$applyToAllLabel = _ref.applyToAllLabel,
|
|
35491
|
-
applyToAllLabel = _ref$applyToAllLabel === void 0 ? "All Projects" : _ref$applyToAllLabel,
|
|
35492
35954
|
_ref$applyToAllTitle = _ref.applyToAllTitle,
|
|
35493
35955
|
applyToAllTitle = _ref$applyToAllTitle === void 0 ? "Apply to All Projects" : _ref$applyToAllTitle,
|
|
35494
35956
|
offerTitle = _ref.offerTitle,
|
|
35495
|
-
_ref$dismissLabel = _ref.dismissLabel,
|
|
35496
|
-
dismissLabel = _ref$dismissLabel === void 0 ? "Dismiss" : _ref$dismissLabel,
|
|
35497
35957
|
_ref$appliedLabel = _ref.appliedLabel,
|
|
35498
35958
|
appliedLabel = _ref$appliedLabel === void 0 ? "Applied" : _ref$appliedLabel,
|
|
35959
|
+
_ref$applyToAllLabel = _ref.applyToAllLabel,
|
|
35960
|
+
applyToAllLabel = _ref$applyToAllLabel === void 0 ? "All Projects?" : _ref$applyToAllLabel,
|
|
35961
|
+
_ref$dismissLabel = _ref.dismissLabel,
|
|
35962
|
+
dismissLabel = _ref$dismissLabel === void 0 ? "Dismiss" : _ref$dismissLabel,
|
|
35499
35963
|
offerKey = _ref.offerKey,
|
|
35500
35964
|
className = _ref.className,
|
|
35501
35965
|
onKeyDown = _ref.onKeyDown,
|
|
@@ -35504,55 +35968,40 @@
|
|
|
35504
35968
|
var rootRef = React.useRef(null);
|
|
35505
35969
|
var handleRootRef = useForkRef(rootRef, ref);
|
|
35506
35970
|
var optionRefs = React.useRef({});
|
|
35507
|
-
var promptRef = React.useRef(null);
|
|
35508
|
-
var _useState = React.useState(null),
|
|
35509
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
35510
|
-
offerId = _useState2[0],
|
|
35511
|
-
setOfferId = _useState2[1];
|
|
35512
|
-
var _useState3 = React.useState("waiting"),
|
|
35513
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
35514
|
-
offerPhase = _useState4[0],
|
|
35515
|
-
setOfferPhase = _useState4[1];
|
|
35516
|
-
var _useState5 = React.useState(false),
|
|
35517
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
35518
|
-
isConfirmed = _useState6[0],
|
|
35519
|
-
setIsConfirmed = _useState6[1];
|
|
35520
|
-
var offerTitleId = React.useId();
|
|
35521
|
-
var offerIdRef = React.useRef(offerId);
|
|
35522
|
-
var offerPhaseRef = React.useRef(offerPhase);
|
|
35523
|
-
var restoreFocusRef = React.useRef(false);
|
|
35524
|
-
offerIdRef.current = offerId;
|
|
35525
|
-
offerPhaseRef.current = offerPhase;
|
|
35526
35971
|
var checkedIndex = views.findIndex(function (_ref2) {
|
|
35527
35972
|
var id = _ref2.id;
|
|
35528
35973
|
return id === value;
|
|
35529
35974
|
});
|
|
35530
35975
|
var tabStopId = (_views = views[checkedIndex >= 0 ? checkedIndex : 0]) === null || _views === void 0 ? void 0 : _views.id;
|
|
35976
|
+
var focusChecked = React.useCallback(function () {
|
|
35977
|
+
if (tabStopId) {
|
|
35978
|
+
var _optionRefs$current$t;
|
|
35979
|
+
(_optionRefs$current$t = optionRefs.current[tabStopId]) === null || _optionRefs$current$t === void 0 || _optionRefs$current$t.focus();
|
|
35980
|
+
}
|
|
35981
|
+
}, [tabStopId]);
|
|
35982
|
+
var offer = useApplyToAllOffer({
|
|
35983
|
+
rootRef,
|
|
35984
|
+
onApplyToAll,
|
|
35985
|
+
onRestoreFocus: focusChecked
|
|
35986
|
+
});
|
|
35987
|
+
var show = offer.show,
|
|
35988
|
+
isUp = offer.isUp;
|
|
35531
35989
|
var offerView = views.find(function (_ref3) {
|
|
35990
|
+
var _offer$offer;
|
|
35532
35991
|
var id = _ref3.id;
|
|
35533
|
-
return id ===
|
|
35992
|
+
return id === ((_offer$offer = offer.offer) === null || _offer$offer === void 0 ? void 0 : _offer$offer.value);
|
|
35534
35993
|
});
|
|
35535
35994
|
var select = React.useCallback(function (id) {
|
|
35536
35995
|
// A click on the checked view also offers the extra action.
|
|
35537
35996
|
if (id === value) {
|
|
35538
|
-
|
|
35539
|
-
|
|
35540
|
-
setOfferPhase("waiting");
|
|
35541
|
-
setIsConfirmed(false);
|
|
35542
|
-
setOfferId(id);
|
|
35997
|
+
if (!isUp) {
|
|
35998
|
+
show(id);
|
|
35543
35999
|
}
|
|
35544
36000
|
return;
|
|
35545
36001
|
}
|
|
35546
36002
|
onChange(id);
|
|
35547
|
-
|
|
35548
|
-
|
|
35549
|
-
setOfferPhase(function (phase) {
|
|
35550
|
-
return offerIdRef.current && phase === "open" ? "open" : "waiting";
|
|
35551
|
-
});
|
|
35552
|
-
setIsConfirmed(false);
|
|
35553
|
-
setOfferId(id);
|
|
35554
|
-
}
|
|
35555
|
-
}, [onApplyToAll, onChange, value]);
|
|
36003
|
+
show(id);
|
|
36004
|
+
}, [isUp, onChange, show, value]);
|
|
35556
36005
|
var seenOfferKeyRef = React.useRef(offerKey);
|
|
35557
36006
|
React.useEffect(function () {
|
|
35558
36007
|
if (seenOfferKeyRef.current === offerKey) {
|
|
@@ -35563,70 +36012,6 @@
|
|
|
35563
36012
|
select(value);
|
|
35564
36013
|
}
|
|
35565
36014
|
}, [offerKey, select, value]);
|
|
35566
|
-
var isInside = function isInside(node) {
|
|
35567
|
-
var _rootRef$current;
|
|
35568
|
-
return Boolean(node && ((_rootRef$current = rootRef.current) === null || _rootRef$current === void 0 ? void 0 : _rootRef$current.contains(node)));
|
|
35569
|
-
};
|
|
35570
|
-
var focusChecked = React.useCallback(function () {
|
|
35571
|
-
if (tabStopId) {
|
|
35572
|
-
var _optionRefs$current$t;
|
|
35573
|
-
(_optionRefs$current$t = optionRefs.current[tabStopId]) === null || _optionRefs$current$t === void 0 || _optionRefs$current$t.focus();
|
|
35574
|
-
}
|
|
35575
|
-
}, [tabStopId]);
|
|
35576
|
-
var leave = React.useCallback(function () {
|
|
35577
|
-
var _promptRef$current;
|
|
35578
|
-
restoreFocusRef.current = Boolean((_promptRef$current = promptRef.current) === null || _promptRef$current === void 0 ? void 0 : _promptRef$current.contains(document.activeElement));
|
|
35579
|
-
if (offerPhaseRef.current === "waiting") {
|
|
35580
|
-
setOfferId(null);
|
|
35581
|
-
return;
|
|
35582
|
-
}
|
|
35583
|
-
setOfferPhase("leaving");
|
|
35584
|
-
}, []);
|
|
35585
|
-
React.useEffect(function () {
|
|
35586
|
-
if (!offerId && restoreFocusRef.current) {
|
|
35587
|
-
restoreFocusRef.current = false;
|
|
35588
|
-
focusChecked();
|
|
35589
|
-
}
|
|
35590
|
-
}, [focusChecked, offerId]);
|
|
35591
|
-
React.useEffect(function () {
|
|
35592
|
-
if (!offerId || offerPhase === "applying") {
|
|
35593
|
-
return undefined;
|
|
35594
|
-
}
|
|
35595
|
-
if (offerPhase === "waiting") {
|
|
35596
|
-
var _timer = setTimeout(function () {
|
|
35597
|
-
return setOfferPhase("open");
|
|
35598
|
-
}, VIEW_SWITCHER_PROMPT_DELAY_MS);
|
|
35599
|
-
return function () {
|
|
35600
|
-
return clearTimeout(_timer);
|
|
35601
|
-
};
|
|
35602
|
-
}
|
|
35603
|
-
if (offerPhase === "leaving") {
|
|
35604
|
-
var _timer2 = setTimeout(function () {
|
|
35605
|
-
return setOfferId(null);
|
|
35606
|
-
}, VIEW_SWITCHER_LEAVE_MS);
|
|
35607
|
-
return function () {
|
|
35608
|
-
return clearTimeout(_timer2);
|
|
35609
|
-
};
|
|
35610
|
-
}
|
|
35611
|
-
var timer = setTimeout(leave, offerPhase === "applied" ? VIEW_SWITCHER_APPLIED_MS : VIEW_SWITCHER_PROMPT_MS);
|
|
35612
|
-
return function () {
|
|
35613
|
-
return clearTimeout(timer);
|
|
35614
|
-
};
|
|
35615
|
-
}, [leave, offerId, offerPhase]);
|
|
35616
|
-
React.useEffect(function () {
|
|
35617
|
-
if (!offerId) {
|
|
35618
|
-
return undefined;
|
|
35619
|
-
}
|
|
35620
|
-
var leaveOutside = function leaveOutside(event) {
|
|
35621
|
-
if (!isInside(event.target)) {
|
|
35622
|
-
leave();
|
|
35623
|
-
}
|
|
35624
|
-
};
|
|
35625
|
-
document.addEventListener("mousedown", leaveOutside);
|
|
35626
|
-
return function () {
|
|
35627
|
-
return document.removeEventListener("mousedown", leaveOutside);
|
|
35628
|
-
};
|
|
35629
|
-
}, [leave, offerId]);
|
|
35630
36015
|
var handleOptionKeyDown = function handleOptionKeyDown(event, index) {
|
|
35631
36016
|
var _optionRefs$current$i;
|
|
35632
36017
|
var last = views.length - 1;
|
|
@@ -35649,46 +36034,11 @@
|
|
|
35649
36034
|
};
|
|
35650
36035
|
var handleRootKeyDown = function handleRootKeyDown(event) {
|
|
35651
36036
|
onKeyDown === null || onKeyDown === void 0 || onKeyDown(event);
|
|
35652
|
-
|
|
35653
|
-
return;
|
|
35654
|
-
}
|
|
35655
|
-
if (offerPhase === "waiting") {
|
|
35656
|
-
leave();
|
|
35657
|
-
return;
|
|
35658
|
-
}
|
|
35659
|
-
|
|
35660
|
-
// A native dialog around the switcher would take an Escape that is not prevented as its own close request.
|
|
35661
|
-
event.preventDefault();
|
|
35662
|
-
event.stopPropagation();
|
|
35663
|
-
leave();
|
|
36037
|
+
offer.handleKeyDown(event);
|
|
35664
36038
|
};
|
|
35665
36039
|
var handleRootBlur = function handleRootBlur(event) {
|
|
35666
36040
|
onBlur === null || onBlur === void 0 || onBlur(event);
|
|
35667
|
-
|
|
35668
|
-
if (offerId && next && !isInside(next)) {
|
|
35669
|
-
leave();
|
|
35670
|
-
}
|
|
35671
|
-
};
|
|
35672
|
-
var applyToAll = async function applyToAll() {
|
|
35673
|
-
var _promptRef$current2;
|
|
35674
|
-
if (!offerId || !onApplyToAll || offerPhase !== "open") {
|
|
35675
|
-
return;
|
|
35676
|
-
}
|
|
35677
|
-
var isApplied = false;
|
|
35678
|
-
|
|
35679
|
-
// The action hides while it confirms, so the focus goes back to the views now.
|
|
35680
|
-
if ((_promptRef$current2 = promptRef.current) !== null && _promptRef$current2 !== void 0 && _promptRef$current2.contains(document.activeElement)) {
|
|
35681
|
-
focusChecked();
|
|
35682
|
-
}
|
|
35683
|
-
setOfferPhase("applying");
|
|
35684
|
-
try {
|
|
35685
|
-
isApplied = (await onApplyToAll(offerId)) !== false;
|
|
35686
|
-
} finally {
|
|
35687
|
-
if (offerIdRef.current === offerId) {
|
|
35688
|
-
setIsConfirmed(isApplied);
|
|
35689
|
-
setOfferPhase(isApplied ? "applied" : "leaving");
|
|
35690
|
-
}
|
|
35691
|
-
}
|
|
36041
|
+
offer.handleBlur(event);
|
|
35692
36042
|
};
|
|
35693
36043
|
return /*#__PURE__*/React__default["default"].createElement(StyledViewSwitcher, _extends({
|
|
35694
36044
|
ref: handleRootRef,
|
|
@@ -35697,38 +36047,7 @@
|
|
|
35697
36047
|
onBlur: handleRootBlur
|
|
35698
36048
|
}, rest), /*#__PURE__*/React__default["default"].createElement(StyledViewSwitcherTrack, {
|
|
35699
36049
|
className: "c-view-switcher__track"
|
|
35700
|
-
},
|
|
35701
|
-
ref: promptRef,
|
|
35702
|
-
role: "group",
|
|
35703
|
-
"aria-labelledby": offerTitleId,
|
|
35704
|
-
className: "c-view-switcher__prompt",
|
|
35705
|
-
"data-phase": offerPhase,
|
|
35706
|
-
"data-confirmed": isConfirmed || undefined
|
|
35707
|
-
}, /*#__PURE__*/React__default["default"].createElement(StyledViewSwitcherPromptTitle, {
|
|
35708
|
-
id: offerTitleId
|
|
35709
|
-
}, offerTitle ? offerTitle(offerView) : "Now in ".concat(offerView.label)), /*#__PURE__*/React__default["default"].createElement(StyledViewSwitcherPromptClip, null, /*#__PURE__*/React__default["default"].createElement(StyledViewSwitcherPromptPill, {
|
|
35710
|
-
className: "c-view-switcher__prompt-pill"
|
|
35711
|
-
}, /*#__PURE__*/React__default["default"].createElement(Tooltip, {
|
|
35712
|
-
title: applyToAllTitle,
|
|
35713
|
-
placement: "bottom"
|
|
35714
|
-
}, /*#__PURE__*/React__default["default"].createElement(StyledViewSwitcherAction, {
|
|
35715
|
-
type: "button",
|
|
35716
|
-
"aria-label": applyToAllTitle,
|
|
35717
|
-
className: "c-view-switcher__action",
|
|
35718
|
-
onClick: applyToAll
|
|
35719
|
-
}, /*#__PURE__*/React__default["default"].createElement(CheckIcon$1, null), applyToAllLabel)), /*#__PURE__*/React__default["default"].createElement(StyledViewSwitcherLine, {
|
|
35720
|
-
className: "c-view-switcher__line"
|
|
35721
|
-
}), /*#__PURE__*/React__default["default"].createElement(Tooltip, {
|
|
35722
|
-
title: dismissLabel,
|
|
35723
|
-
placement: "bottom"
|
|
35724
|
-
}, /*#__PURE__*/React__default["default"].createElement(StyledViewSwitcherDismiss, {
|
|
35725
|
-
type: "button",
|
|
35726
|
-
"aria-label": dismissLabel,
|
|
35727
|
-
className: "c-view-switcher__dismiss",
|
|
35728
|
-
onClick: leave
|
|
35729
|
-
}, /*#__PURE__*/React__default["default"].createElement(CloseSmallIcon$1, null))), isConfirmed ? /*#__PURE__*/React__default["default"].createElement(StyledViewSwitcherApplied, {
|
|
35730
|
-
role: "status"
|
|
35731
|
-
}, /*#__PURE__*/React__default["default"].createElement(CheckIcon$1, null), appliedLabel) : null))) : null, /*#__PURE__*/React__default["default"].createElement(StyledViewSwitcherOptions, {
|
|
36050
|
+
}, /*#__PURE__*/React__default["default"].createElement(StyledViewSwitcherOptions, {
|
|
35732
36051
|
role: "radiogroup",
|
|
35733
36052
|
"aria-label": ariaLabel
|
|
35734
36053
|
}, views.map(function (view, index) {
|
|
@@ -35736,7 +36055,7 @@
|
|
|
35736
36055
|
return /*#__PURE__*/React__default["default"].createElement(Tooltip, {
|
|
35737
36056
|
key: view.id,
|
|
35738
36057
|
title: view.label,
|
|
35739
|
-
placement: "
|
|
36058
|
+
placement: "top"
|
|
35740
36059
|
}, /*#__PURE__*/React__default["default"].createElement(StyledViewSwitcherOption, {
|
|
35741
36060
|
ref: function ref(node) {
|
|
35742
36061
|
optionRefs.current[view.id] = node;
|
|
@@ -35754,20 +36073,33 @@
|
|
|
35754
36073
|
return handleOptionKeyDown(event, index);
|
|
35755
36074
|
}
|
|
35756
36075
|
}, view.icon));
|
|
35757
|
-
})))
|
|
36076
|
+
}))), offerView && offer.isShown ? /*#__PURE__*/React__default["default"].createElement(ApplyToAllTab, {
|
|
36077
|
+
ref: offer.tabRef,
|
|
36078
|
+
phase: offer.phase,
|
|
36079
|
+
isConfirmed: offer.isConfirmed,
|
|
36080
|
+
title: applyToAllTitle,
|
|
36081
|
+
label: offerTitle ? offerTitle(offerView) : "Now in ".concat(offerView.label),
|
|
36082
|
+
appliedLabel: appliedLabel,
|
|
36083
|
+
onApply: offer.apply,
|
|
36084
|
+
onDismiss: offer.leave,
|
|
36085
|
+
onHold: offer.hold,
|
|
36086
|
+
dismissLabel: dismissLabel,
|
|
36087
|
+
applyToAllLabel: applyToAllLabel
|
|
36088
|
+
}) : null);
|
|
35758
36089
|
});
|
|
35759
36090
|
ViewSwitcher.displayName = "ViewSwitcher";
|
|
35760
36091
|
|
|
35761
|
-
var _excluded$12 = ["options", "value", "onChange", "aria-label", "animateIn", "leaving", "className"];
|
|
36092
|
+
var _excluded$12 = ["options", "value", "onChange", "aria-label", "animateIn", "leaving", "onApplyToAll", "applyToAllTitle", "appliedLabel", "applyToAllLabel", "dismissLabel", "className", "onKeyDown", "onBlur"];
|
|
35762
36093
|
/**
|
|
35763
|
-
* @component
|
|
36094
|
+
* @component SubViewSwitcher
|
|
35764
36095
|
* @description
|
|
35765
|
-
*
|
|
36096
|
+
* The sub view switcher, the second level of the main ViewSwitcher: a dropdown with the look of the checked option. It
|
|
35766
36097
|
* shows the icon and the name of the selected option and lists all options with their icons. Its width
|
|
35767
|
-
* fits the widest option, so a new selection does not move the controls around it.
|
|
36098
|
+
* fits the widest option, so a new selection does not move the controls around it. With onApplyToAll, a
|
|
36099
|
+
* choice slides a check button out from under its right end, the same as in ViewSwitcher.
|
|
35768
36100
|
*
|
|
35769
36101
|
* @example
|
|
35770
|
-
* <
|
|
36102
|
+
* <SubViewSwitcher
|
|
35771
36103
|
* aria-label="Group by"
|
|
35772
36104
|
* options={[
|
|
35773
36105
|
* { id: "start_date", label: "Start Date", icon: <ClockIcon /> },
|
|
@@ -35777,7 +36109,7 @@
|
|
|
35777
36109
|
* onChange={setView}
|
|
35778
36110
|
* />
|
|
35779
36111
|
*/
|
|
35780
|
-
var
|
|
36112
|
+
var SubViewSwitcher = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
35781
36113
|
var _options$find;
|
|
35782
36114
|
var options = _ref.options,
|
|
35783
36115
|
value = _ref.value,
|
|
@@ -35787,7 +36119,18 @@
|
|
|
35787
36119
|
animateIn = _ref$animateIn === void 0 ? false : _ref$animateIn,
|
|
35788
36120
|
_ref$leaving = _ref.leaving,
|
|
35789
36121
|
leaving = _ref$leaving === void 0 ? false : _ref$leaving,
|
|
36122
|
+
onApplyToAll = _ref.onApplyToAll,
|
|
36123
|
+
_ref$applyToAllTitle = _ref.applyToAllTitle,
|
|
36124
|
+
applyToAllTitle = _ref$applyToAllTitle === void 0 ? "Apply to All Projects" : _ref$applyToAllTitle,
|
|
36125
|
+
_ref$appliedLabel = _ref.appliedLabel,
|
|
36126
|
+
appliedLabel = _ref$appliedLabel === void 0 ? "Applied" : _ref$appliedLabel,
|
|
36127
|
+
_ref$applyToAllLabel = _ref.applyToAllLabel,
|
|
36128
|
+
applyToAllLabel = _ref$applyToAllLabel === void 0 ? "All Projects?" : _ref$applyToAllLabel,
|
|
36129
|
+
_ref$dismissLabel = _ref.dismissLabel,
|
|
36130
|
+
dismissLabel = _ref$dismissLabel === void 0 ? "Dismiss" : _ref$dismissLabel,
|
|
35790
36131
|
className = _ref.className,
|
|
36132
|
+
_onKeyDown = _ref.onKeyDown,
|
|
36133
|
+
_onBlur = _ref.onBlur,
|
|
35791
36134
|
rest = _objectWithoutProperties(_ref, _excluded$12);
|
|
35792
36135
|
var _useState = React.useState(false),
|
|
35793
36136
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -35797,13 +36140,33 @@
|
|
|
35797
36140
|
var id = _ref2.id;
|
|
35798
36141
|
return id === value;
|
|
35799
36142
|
})) !== null && _options$find !== void 0 ? _options$find : options[0];
|
|
35800
|
-
|
|
35801
|
-
|
|
36143
|
+
var rootRef = React.useRef(null);
|
|
36144
|
+
var handleRootRef = useForkRef(rootRef, ref);
|
|
36145
|
+
var triggerRef = React.useRef(null);
|
|
36146
|
+
var focusTrigger = React.useCallback(function () {
|
|
36147
|
+
var _triggerRef$current;
|
|
36148
|
+
return (_triggerRef$current = triggerRef.current) === null || _triggerRef$current === void 0 ? void 0 : _triggerRef$current.focus();
|
|
36149
|
+
}, []);
|
|
36150
|
+
var offer = useApplyToAllOffer({
|
|
36151
|
+
rootRef,
|
|
36152
|
+
onApplyToAll,
|
|
36153
|
+
onRestoreFocus: focusTrigger
|
|
36154
|
+
});
|
|
36155
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledSubViewSwitcherRoot, _extends({
|
|
36156
|
+
ref: handleRootRef,
|
|
35802
36157
|
"data-animate-in": animateIn || undefined,
|
|
35803
36158
|
"data-leaving": leaving || undefined,
|
|
35804
|
-
className: classnames__default["default"]("c-view-switcher
|
|
35805
|
-
|
|
35806
|
-
|
|
36159
|
+
className: classnames__default["default"]("c-sub-view-switcher", className),
|
|
36160
|
+
onKeyDown: function onKeyDown(event) {
|
|
36161
|
+
_onKeyDown === null || _onKeyDown === void 0 || _onKeyDown(event);
|
|
36162
|
+
offer.handleKeyDown(event);
|
|
36163
|
+
},
|
|
36164
|
+
onBlur: function onBlur(event) {
|
|
36165
|
+
_onBlur === null || _onBlur === void 0 || _onBlur(event);
|
|
36166
|
+
offer.handleBlur(event);
|
|
36167
|
+
}
|
|
36168
|
+
}, rest), /*#__PURE__*/React__default["default"].createElement(StyledSubViewSwitcherClip, {
|
|
36169
|
+
className: "c-sub-view-switcher__clip"
|
|
35807
36170
|
}, /*#__PURE__*/React__default["default"].createElement(Menu, {
|
|
35808
36171
|
open: open,
|
|
35809
36172
|
onOpen: function onOpen() {
|
|
@@ -35815,14 +36178,15 @@
|
|
|
35815
36178
|
position: "bottom-end",
|
|
35816
36179
|
target: /*#__PURE__*/React__default["default"].createElement(StyledViewSwitcherTrack, {
|
|
35817
36180
|
className: "c-view-switcher__track"
|
|
35818
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
36181
|
+
}, /*#__PURE__*/React__default["default"].createElement(StyledSubViewSwitcherOption, {
|
|
36182
|
+
ref: triggerRef,
|
|
35819
36183
|
type: "button",
|
|
35820
36184
|
"aria-haspopup": "menu",
|
|
35821
36185
|
"aria-expanded": open,
|
|
35822
36186
|
"aria-label": ariaLabel ? "".concat(ariaLabel, ": ").concat(selected === null || selected === void 0 ? void 0 : selected.label) : selected === null || selected === void 0 ? void 0 : selected.label,
|
|
35823
|
-
className: "c-view-
|
|
36187
|
+
className: "c-sub-view-switcher__trigger"
|
|
35824
36188
|
}, /*#__PURE__*/React__default["default"].createElement("span", {
|
|
35825
|
-
className: "c-view-
|
|
36189
|
+
className: "c-sub-view-switcher__values"
|
|
35826
36190
|
}, options.map(function (_ref3) {
|
|
35827
36191
|
var id = _ref3.id,
|
|
35828
36192
|
label = _ref3.label,
|
|
@@ -35831,12 +36195,12 @@
|
|
|
35831
36195
|
key: id,
|
|
35832
36196
|
"aria-hidden": id !== (selected === null || selected === void 0 ? void 0 : selected.id),
|
|
35833
36197
|
"data-selected": id === (selected === null || selected === void 0 ? void 0 : selected.id),
|
|
35834
|
-
className: "c-view-
|
|
36198
|
+
className: "c-sub-view-switcher__value"
|
|
35835
36199
|
}, icon ? /*#__PURE__*/React__default["default"].createElement("span", {
|
|
35836
|
-
className: "c-view-
|
|
36200
|
+
className: "c-sub-view-switcher__icon"
|
|
35837
36201
|
}, icon) : null, label);
|
|
35838
36202
|
})), /*#__PURE__*/React__default["default"].createElement(ArrowDownSmallIcon$1, null)))
|
|
35839
|
-
}, /*#__PURE__*/React__default["default"].createElement(
|
|
36203
|
+
}, /*#__PURE__*/React__default["default"].createElement(StyledSubViewSwitcherList, null, options.map(function (_ref4) {
|
|
35840
36204
|
var id = _ref4.id,
|
|
35841
36205
|
label = _ref4.label,
|
|
35842
36206
|
icon = _ref4.icon;
|
|
@@ -35847,14 +36211,26 @@
|
|
|
35847
36211
|
setOpen(false);
|
|
35848
36212
|
if (id !== value) {
|
|
35849
36213
|
onChange(id);
|
|
36214
|
+
offer.show(id);
|
|
35850
36215
|
}
|
|
35851
36216
|
}
|
|
35852
|
-
}, icon ? /*#__PURE__*/React__default["default"].createElement(
|
|
36217
|
+
}, icon ? /*#__PURE__*/React__default["default"].createElement(StyledSubViewSwitcherIcon, null, icon) : null, /*#__PURE__*/React__default["default"].createElement(StyledSubViewSwitcherLabel, {
|
|
35853
36218
|
"data-selected": id === (selected === null || selected === void 0 ? void 0 : selected.id)
|
|
35854
36219
|
}, label));
|
|
35855
|
-
})))
|
|
36220
|
+
}))), offer.isShown ? /*#__PURE__*/React__default["default"].createElement(ApplyToAllTab, {
|
|
36221
|
+
ref: offer.tabRef,
|
|
36222
|
+
phase: offer.phase,
|
|
36223
|
+
isConfirmed: offer.isConfirmed,
|
|
36224
|
+
title: applyToAllTitle,
|
|
36225
|
+
appliedLabel: appliedLabel,
|
|
36226
|
+
onApply: offer.apply,
|
|
36227
|
+
onDismiss: offer.leave,
|
|
36228
|
+
onHold: offer.hold,
|
|
36229
|
+
dismissLabel: dismissLabel,
|
|
36230
|
+
applyToAllLabel: applyToAllLabel
|
|
36231
|
+
}) : null));
|
|
35856
36232
|
});
|
|
35857
|
-
|
|
36233
|
+
SubViewSwitcher.displayName = "SubViewSwitcher";
|
|
35858
36234
|
|
|
35859
36235
|
var StyledSelectTrigger = styled__default["default"](Trigger).withConfig({
|
|
35860
36236
|
displayName: "Styles__StyledSelectTrigger",
|
|
@@ -51270,6 +51646,7 @@
|
|
|
51270
51646
|
exports.StopwatchTrigger = StopwatchTrigger;
|
|
51271
51647
|
exports.StorageIcon = StorageIcon$1;
|
|
51272
51648
|
exports.StyledInputTimeWrapper = StyledInputTimeWrapper;
|
|
51649
|
+
exports.SubViewSwitcher = SubViewSwitcher;
|
|
51273
51650
|
exports.SubmenuHeader = SubmenuHeader;
|
|
51274
51651
|
exports.SunIcon = SunIcon$1;
|
|
51275
51652
|
exports.SwatchPicker = SwatchPicker;
|
|
@@ -51339,7 +51716,6 @@
|
|
|
51339
51716
|
exports.ViewListIcon = ViewListIcon$1;
|
|
51340
51717
|
exports.ViewSettings = ViewSettings;
|
|
51341
51718
|
exports.ViewSwitcher = ViewSwitcher;
|
|
51342
|
-
exports.ViewSwitcherMenu = ViewSwitcherMenu;
|
|
51343
51719
|
exports.ViewTimelineIcon = ViewTimelineIcon$1;
|
|
51344
51720
|
exports.VolumeHighIcon = VolumeHighIcon$1;
|
|
51345
51721
|
exports.WarningIcon = WarningIcon$1;
|