@planningcenter/topbar 11.0.2 → 11.0.3-rc.0

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.
@@ -356,7 +356,7 @@
356
356
  fill: fill
357
357
  })));
358
358
 
359
- var styles$b = {"announcement":"announcement-pI5tM","announcement--platform":"announcement--platform-EcUn2","announcement-icon":"announcement-icon-Ov39-","announcement-content":"announcement-content-q2ad6","dismiss":"dismiss-wUAoU"};
359
+ var styles$b = {"announcement":"announcement-pI5tM","announcement--platform":"announcement--platform-EcUn2","announcement--promo":"announcement--promo-FarUk","announcement-icon":"announcement-icon-Ov39-","announcement-content":"announcement-content-q2ad6","dismiss":"dismiss-wUAoU","dismiss--promo":"dismiss--promo-7zvO4"};
360
360
 
361
361
  function AnnouncementIcon() {
362
362
  return /*#__PURE__*/React.createElement("svg", {
@@ -424,11 +424,14 @@
424
424
  render() {
425
425
  const {
426
426
  style,
427
+ variant,
427
428
  ...platformProps
428
429
  } = this.props;
430
+ const isPromo = variant === "promo";
429
431
  return /*#__PURE__*/React.createElement("div", {
430
- className: classnames(styles$b["announcement"], styles$b["announcement--platform"])
431
- }, /*#__PURE__*/React.createElement(AnnouncementIcon, null), /*#__PURE__*/React.createElement("div", {
432
+ className: classnames(styles$b["announcement"], styles$b[`announcement--${variant !== null && variant !== void 0 ? variant : "platform"}`]),
433
+ "data-announcement-variant": variant !== null && variant !== void 0 ? variant : "platform"
434
+ }, !isPromo && /*#__PURE__*/React.createElement(AnnouncementIcon, null), /*#__PURE__*/React.createElement("div", {
432
435
  className: styles$b["announcement-content"],
433
436
  style: style,
434
437
  ...platformProps
@@ -451,10 +454,12 @@
451
454
  env: this.props.env,
452
455
  initialAnnouncements: this.props.data,
453
456
  configuredFetch: this.props.configuredFetch
454
- }, (data, actions) => Boolean(data.announcements.length > 0) ? (/*#__PURE__*/React.createElement("div", null, data.announcements.map(announcement => this.props.renderItem({
455
- actions,
456
- announcement
457
- })))) : null));
457
+ }, (data, actions) => {
458
+ return data.announcements.length > 0 ? (/*#__PURE__*/React.createElement("div", null, data.announcements.map(announcement => this.props.renderItem({
459
+ actions,
460
+ announcement
461
+ })))) : null;
462
+ }));
458
463
  }
459
464
  }
460
465
  PlatformAnnouncements.defaultProps = {
@@ -462,33 +467,39 @@
462
467
  renderItem: ({
463
468
  announcement,
464
469
  actions
465
- }) => (/*#__PURE__*/React.createElement(DissmissibleAnnouncement, {
470
+ }) => (/*#__PURE__*/React.createElement(DismissibleAnnouncement, {
466
471
  key: announcement.id,
467
472
  html: announcement.data.html,
473
+ variant: announcement.data.style,
468
474
  onClick: () => actions.dismissAnnouncements(announcement.id)
469
475
  }))
470
476
  };
471
477
  function StyledDismissButton$1({
478
+ variant,
472
479
  ...props
473
480
  }) {
481
+ const isPromo = variant === "promo";
474
482
  return /*#__PURE__*/React.createElement("button", {
475
483
  type: "button",
476
- className: styles$b.dismiss,
484
+ className: classnames(styles$b.dismiss, isPromo && styles$b["dismiss--promo"]),
477
485
  ...props
478
486
  }, /*#__PURE__*/React.createElement(X, {
479
- fill: "white",
487
+ fill: isPromo ? "currentColor" : "white",
480
488
  style: {
481
489
  height: 20,
482
490
  width: 20
483
491
  }
484
492
  }));
485
493
  }
486
- function DissmissibleAnnouncement(props) {
487
- return /*#__PURE__*/React.createElement(StyledAnnouncement$1, null, /*#__PURE__*/React.createElement("span", {
494
+ function DismissibleAnnouncement(props) {
495
+ return /*#__PURE__*/React.createElement(StyledAnnouncement$1, {
496
+ variant: props.variant
497
+ }, /*#__PURE__*/React.createElement("span", {
488
498
  dangerouslySetInnerHTML: {
489
499
  __html: props.html
490
500
  }
491
501
  }), /*#__PURE__*/React.createElement(StyledDismissButton$1, {
502
+ variant: props.variant,
492
503
  onClick: props.onClick
493
504
  }));
494
505
  }
@@ -685,6 +696,39 @@
685
696
  }, [channelSubscription, callback]);
686
697
  };
687
698
 
699
+ function useMediaQuery(query) {
700
+ const getMatches = query => {
701
+ // Prevents SSR issues
702
+ if (typeof window !== "undefined") {
703
+ return window.matchMedia(query).matches;
704
+ }
705
+ return false;
706
+ };
707
+ const [matches, setMatches] = React.useState(getMatches(query));
708
+ function handleChange() {
709
+ setMatches(getMatches(query));
710
+ }
711
+ React.useEffect(() => {
712
+ const matchMedia = window.matchMedia(query);
713
+ // Triggered at the first client-side load and if query changes
714
+ handleChange();
715
+ // Listen matchMedia
716
+ if (matchMedia.addListener) {
717
+ matchMedia.addListener(handleChange);
718
+ } else {
719
+ matchMedia.addEventListener("change", handleChange);
720
+ }
721
+ return () => {
722
+ if (matchMedia.removeListener) {
723
+ matchMedia.removeListener(handleChange);
724
+ } else {
725
+ matchMedia.removeEventListener("change", handleChange);
726
+ }
727
+ };
728
+ }, [query]);
729
+ return matches;
730
+ }
731
+
688
732
  const capitalize = s => s.charAt(0).toUpperCase() + s.slice(1);
689
733
  const RESOLVED_COLOR_MODE_ATTRIBUTE = "data-resolved-color-mode";
690
734
  function resolveColorMode(colorMode) {
@@ -773,39 +817,6 @@
773
817
  return storedValue;
774
818
  };
775
819
 
776
- function useMediaQuery(query) {
777
- const getMatches = query => {
778
- // Prevents SSR issues
779
- if (typeof window !== "undefined") {
780
- return window.matchMedia(query).matches;
781
- }
782
- return false;
783
- };
784
- const [matches, setMatches] = React.useState(getMatches(query));
785
- function handleChange() {
786
- setMatches(getMatches(query));
787
- }
788
- React.useEffect(() => {
789
- const matchMedia = window.matchMedia(query);
790
- // Triggered at the first client-side load and if query changes
791
- handleChange();
792
- // Listen matchMedia
793
- if (matchMedia.addListener) {
794
- matchMedia.addListener(handleChange);
795
- } else {
796
- matchMedia.addEventListener("change", handleChange);
797
- }
798
- return () => {
799
- if (matchMedia.removeListener) {
800
- matchMedia.removeListener(handleChange);
801
- } else {
802
- matchMedia.removeEventListener("change", handleChange);
803
- }
804
- };
805
- }, [query]);
806
- return matches;
807
- }
808
-
809
820
  function createStore(initialState) {
810
821
  let currentState = initialState;
811
822
  const listeners = new Set();
@@ -2468,7 +2479,7 @@
2468
2479
  width: 24,
2469
2480
  xmlns: "http://www.w3.org/2000/svg"
2470
2481
  }, /*#__PURE__*/React.createElement(Accounts$1, {
2471
- color: "var(--t-icon-color-secondary",
2482
+ color: "var(--t-icon-color-secondary)",
2472
2483
  key: "key2"
2473
2484
  })), /*#__PURE__*/React.createElement("span", null, "Account settings"));
2474
2485
  }
@@ -2716,8 +2727,8 @@
2716
2727
  function onHashChange() {
2717
2728
  updateFragment(location.hash);
2718
2729
  }
2719
- window.addEventListener('hashchange', onHashChange);
2720
- return () => window.removeEventListener('hashchange', onHashChange);
2730
+ window.addEventListener("hashchange", onHashChange);
2731
+ return () => window.removeEventListener("hashchange", onHashChange);
2721
2732
  }, [updateFragment]);
2722
2733
  return [value, updateFragment];
2723
2734
  }
@@ -2731,9 +2742,9 @@
2731
2742
  }, [updateFragment]);
2732
2743
  const route = React.useMemo(() => {
2733
2744
  if (toolbarFragment) {
2734
- const [tool, ...rest] = toolbarFragment.split('/');
2745
+ const [tool, ...rest] = toolbarFragment.split("/");
2735
2746
  return {
2736
- path: rest.join('/'),
2747
+ path: rest.join("/"),
2737
2748
  tool
2738
2749
  };
2739
2750
  } else {
@@ -4267,11 +4278,11 @@
4267
4278
  return iframeSrc;
4268
4279
  }
4269
4280
  function encodeQueryString(path) {
4270
- const [pathPart, queryPart] = path.split('?', 2);
4281
+ const [pathPart, queryPart] = path.split("?", 2);
4271
4282
  return queryPart ? `${pathPart}?${encodeURIComponent(queryPart)}` : pathPart;
4272
4283
  }
4273
4284
  function decodeQueryString(path) {
4274
- const [pathPart, queryPart] = path.split('?', 2);
4285
+ const [pathPart, queryPart] = path.split("?", 2);
4275
4286
  return queryPart ? `${pathPart}?${decodeURIComponent(queryPart)}` : pathPart;
4276
4287
  }
4277
4288