@embedreach/components 0.1.31 → 0.1.33

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.
@@ -8548,7 +8548,7 @@ const useThemeContext = () => {
8548
8548
  applyTheme
8549
8549
  };
8550
8550
  };
8551
- const ThemeProvider = ({
8551
+ const InnerThemeProvider = ({
8552
8552
  children: children2,
8553
8553
  theme: theme2
8554
8554
  }) => {
@@ -8564,7 +8564,13 @@ const ThemeProvider = ({
8564
8564
  if (themeLoading && theme2) {
8565
8565
  return /* @__PURE__ */ jsx("div", { className: "flex flex-col justify-center items-center h-screen", children: /* @__PURE__ */ jsx(SpinLoader, { text: [t3("loading")] }) });
8566
8566
  }
8567
- return /* @__PURE__ */ jsx(Provider$2, { children: children2 });
8567
+ return /* @__PURE__ */ jsx(Fragment, { children: children2 });
8568
+ };
8569
+ const ThemeProvider = ({
8570
+ children: children2,
8571
+ theme: theme2
8572
+ }) => {
8573
+ return /* @__PURE__ */ jsx(Provider$2, { children: /* @__PURE__ */ jsx(InnerThemeProvider, { theme: theme2, children: children2 }) });
8568
8574
  };
8569
8575
  const isString = (obj) => typeof obj === "string";
8570
8576
  const defer = () => {
@@ -24713,6 +24719,102 @@ function isDate$2(val) {
24713
24719
  *
24714
24720
  * @license MIT
24715
24721
  */
24722
+ function createMemoryHistory(options = {}) {
24723
+ let { initialEntries = ["/"], initialIndex, v5Compat = false } = options;
24724
+ let entries;
24725
+ entries = initialEntries.map(
24726
+ (entry, index22) => createMemoryLocation(
24727
+ entry,
24728
+ typeof entry === "string" ? null : entry.state,
24729
+ index22 === 0 ? "default" : void 0
24730
+ )
24731
+ );
24732
+ let index2 = clampIndex(
24733
+ initialIndex == null ? entries.length - 1 : initialIndex
24734
+ );
24735
+ let action = "POP";
24736
+ let listener = null;
24737
+ function clampIndex(n2) {
24738
+ return Math.min(Math.max(n2, 0), entries.length - 1);
24739
+ }
24740
+ function getCurrentLocation() {
24741
+ return entries[index2];
24742
+ }
24743
+ function createMemoryLocation(to, state = null, key) {
24744
+ let location = createLocation(
24745
+ entries ? getCurrentLocation().pathname : "/",
24746
+ to,
24747
+ state,
24748
+ key
24749
+ );
24750
+ warning(
24751
+ location.pathname.charAt(0) === "/",
24752
+ `relative pathnames are not supported in memory history: ${JSON.stringify(
24753
+ to
24754
+ )}`
24755
+ );
24756
+ return location;
24757
+ }
24758
+ function createHref2(to) {
24759
+ return typeof to === "string" ? to : createPath(to);
24760
+ }
24761
+ let history = {
24762
+ get index() {
24763
+ return index2;
24764
+ },
24765
+ get action() {
24766
+ return action;
24767
+ },
24768
+ get location() {
24769
+ return getCurrentLocation();
24770
+ },
24771
+ createHref: createHref2,
24772
+ createURL(to) {
24773
+ return new URL(createHref2(to), "http://localhost");
24774
+ },
24775
+ encodeLocation(to) {
24776
+ let path2 = typeof to === "string" ? parsePath(to) : to;
24777
+ return {
24778
+ pathname: path2.pathname || "",
24779
+ search: path2.search || "",
24780
+ hash: path2.hash || ""
24781
+ };
24782
+ },
24783
+ push(to, state) {
24784
+ action = "PUSH";
24785
+ let nextLocation = createMemoryLocation(to, state);
24786
+ index2 += 1;
24787
+ entries.splice(index2, entries.length, nextLocation);
24788
+ if (v5Compat && listener) {
24789
+ listener({ action, location: nextLocation, delta: 1 });
24790
+ }
24791
+ },
24792
+ replace(to, state) {
24793
+ action = "REPLACE";
24794
+ let nextLocation = createMemoryLocation(to, state);
24795
+ entries[index2] = nextLocation;
24796
+ if (v5Compat && listener) {
24797
+ listener({ action, location: nextLocation, delta: 0 });
24798
+ }
24799
+ },
24800
+ go(delta) {
24801
+ action = "POP";
24802
+ let nextIndex = clampIndex(index2 + delta);
24803
+ let nextLocation = entries[nextIndex];
24804
+ index2 = nextIndex;
24805
+ if (listener) {
24806
+ listener({ action, location: nextLocation, delta });
24807
+ }
24808
+ },
24809
+ listen(fn) {
24810
+ listener = fn;
24811
+ return () => {
24812
+ listener = null;
24813
+ };
24814
+ }
24815
+ };
24816
+ return history;
24817
+ }
24716
24818
  function invariant(value, message2) {
24717
24819
  if (value === false || value === null || typeof value === "undefined") {
24718
24820
  throw new Error(message2);
@@ -24727,6 +24829,24 @@ function warning(cond, message2) {
24727
24829
  }
24728
24830
  }
24729
24831
  }
24832
+ function createKey() {
24833
+ return Math.random().toString(36).substring(2, 10);
24834
+ }
24835
+ function createLocation(current, to, state = null, key) {
24836
+ let location = {
24837
+ pathname: typeof current === "string" ? current : current.pathname,
24838
+ search: "",
24839
+ hash: "",
24840
+ ...typeof to === "string" ? parsePath(to) : to,
24841
+ state,
24842
+ // TODO: This could be cleaned up. push/replace should probably just take
24843
+ // full Locations now and avoid the need to run through this flow at all
24844
+ // But that's a pretty big refactor to the current test suite so going to
24845
+ // keep as is for the time being and just let any incoming keys take precedence
24846
+ key: to && to.key || key || createKey()
24847
+ };
24848
+ return location;
24849
+ }
24730
24850
  function createPath({
24731
24851
  pathname = "/",
24732
24852
  search = "",
@@ -25604,6 +25724,100 @@ function DataRoutes({
25604
25724
  }) {
25605
25725
  return useRoutesImpl(routes, void 0, state, future);
25606
25726
  }
25727
+ function MemoryRouter({
25728
+ basename,
25729
+ children: children2,
25730
+ initialEntries,
25731
+ initialIndex
25732
+ }) {
25733
+ let historyRef = React.useRef();
25734
+ if (historyRef.current == null) {
25735
+ historyRef.current = createMemoryHistory({
25736
+ initialEntries,
25737
+ initialIndex,
25738
+ v5Compat: true
25739
+ });
25740
+ }
25741
+ let history = historyRef.current;
25742
+ let [state, setStateImpl] = React.useState({
25743
+ action: history.action,
25744
+ location: history.location
25745
+ });
25746
+ let setState = React.useCallback(
25747
+ (newState) => {
25748
+ React.startTransition(() => setStateImpl(newState));
25749
+ },
25750
+ [setStateImpl]
25751
+ );
25752
+ React.useLayoutEffect(() => history.listen(setState), [history, setState]);
25753
+ return /* @__PURE__ */ React.createElement(
25754
+ Router,
25755
+ {
25756
+ basename,
25757
+ children: children2,
25758
+ location: state.location,
25759
+ navigationType: state.action,
25760
+ navigator: history
25761
+ }
25762
+ );
25763
+ }
25764
+ function Router({
25765
+ basename: basenameProp = "/",
25766
+ children: children2 = null,
25767
+ location: locationProp,
25768
+ navigationType = "POP",
25769
+ navigator: navigator2,
25770
+ static: staticProp = false
25771
+ }) {
25772
+ invariant(
25773
+ !useInRouterContext(),
25774
+ `You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`
25775
+ );
25776
+ let basename = basenameProp.replace(/^\/*/, "/");
25777
+ let navigationContext = React.useMemo(
25778
+ () => ({
25779
+ basename,
25780
+ navigator: navigator2,
25781
+ static: staticProp,
25782
+ future: {}
25783
+ }),
25784
+ [basename, navigator2, staticProp]
25785
+ );
25786
+ if (typeof locationProp === "string") {
25787
+ locationProp = parsePath(locationProp);
25788
+ }
25789
+ let {
25790
+ pathname = "/",
25791
+ search = "",
25792
+ hash = "",
25793
+ state = null,
25794
+ key = "default"
25795
+ } = locationProp;
25796
+ let locationContext = React.useMemo(() => {
25797
+ let trailingPathname = stripBasename(pathname, basename);
25798
+ if (trailingPathname == null) {
25799
+ return null;
25800
+ }
25801
+ return {
25802
+ location: {
25803
+ pathname: trailingPathname,
25804
+ search,
25805
+ hash,
25806
+ state,
25807
+ key
25808
+ },
25809
+ navigationType
25810
+ };
25811
+ }, [basename, pathname, search, hash, state, key, navigationType]);
25812
+ warning(
25813
+ locationContext != null,
25814
+ `<Router basename="${basename}"> is not able to match the URL "${pathname}${search}${hash}" because it does not start with the basename, so the <Router> won't render anything.`
25815
+ );
25816
+ if (locationContext == null) {
25817
+ return null;
25818
+ }
25819
+ return /* @__PURE__ */ React.createElement(NavigationContext$1.Provider, { value: navigationContext }, /* @__PURE__ */ React.createElement(LocationContext.Provider, { children: children2, value: locationContext }));
25820
+ }
25607
25821
  var defaultMethod = "get";
25608
25822
  var defaultEncType = "application/x-www-form-urlencoded";
25609
25823
  function isHtmlElement(object) {
@@ -46718,7 +46932,7 @@ const ViewAutomationHeader = ({
46718
46932
  ] })
46719
46933
  ] });
46720
46934
  };
46721
- const ViewAutomationModal = ({
46935
+ const ViewAutomationModalContent = ({
46722
46936
  iconDefinitions,
46723
46937
  autoOpenEditPopup,
46724
46938
  automationId,
@@ -46727,7 +46941,7 @@ const ViewAutomationModal = ({
46727
46941
  }) => {
46728
46942
  const params = useParams();
46729
46943
  const [searchParams] = useSearchParams();
46730
- const FINAL_AUTOMATION_ID = automationId || params.automationId || searchParams.get("automationId");
46944
+ const FINAL_AUTOMATION_ID = automationId || params?.automationId || searchParams.get("automationId");
46731
46945
  const AUTO_OPEN_EDIT_POPUP = autoOpenEditPopup || searchParams.get("autoOpenEditPopup");
46732
46946
  const FINAL_SHOW_BACK_BUTTON = searchParams.get("showBackButton") === "true" || showBackButton;
46733
46947
  const mergedIconDefinitions = mergeIconDefinitions(iconDefinitions);
@@ -46780,6 +46994,12 @@ const ViewAutomationModal = ({
46780
46994
  ] }) })
46781
46995
  ] });
46782
46996
  };
46997
+ const ViewAutomationModal = ({ inRouter = false, ...props }) => {
46998
+ if (inRouter) {
46999
+ return /* @__PURE__ */ jsx(ViewAutomationModalContent, { ...props });
47000
+ }
47001
+ return /* @__PURE__ */ jsx(MemoryRouter, { children: /* @__PURE__ */ jsx(ViewAutomationModalContent, { ...props }) });
47002
+ };
46783
47003
  export {
46784
47004
  $TRACK as $,
46785
47005
  getQueryStatusColorByLabel as A,
package/dist/index.d.ts CHANGED
@@ -171,7 +171,9 @@ declare interface ThemeStyles {
171
171
  'font-heading'?: string;
172
172
  }
173
173
 
174
- export declare const ViewAutomationModal: default_2.FC<ViewAutomationModalProps>;
174
+ export declare const ViewAutomationModal: default_2.FC<ViewAutomationModalProps & {
175
+ inRouter?: boolean;
176
+ }>;
175
177
 
176
178
  declare type ViewAutomationModalProps = {
177
179
  /**
package/dist/index.umd.js CHANGED
@@ -8565,7 +8565,7 @@
8565
8565
  applyTheme
8566
8566
  };
8567
8567
  };
8568
- const ThemeProvider = ({
8568
+ const InnerThemeProvider = ({
8569
8569
  children: children2,
8570
8570
  theme: theme2
8571
8571
  }) => {
@@ -8581,7 +8581,13 @@
8581
8581
  if (themeLoading && theme2) {
8582
8582
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col justify-center items-center h-screen", children: /* @__PURE__ */ jsxRuntime.jsx(SpinLoader, { text: [t2("loading")] }) });
8583
8583
  }
8584
- return /* @__PURE__ */ jsxRuntime.jsx(Provider$2, { children: children2 });
8584
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: children2 });
8585
+ };
8586
+ const ThemeProvider = ({
8587
+ children: children2,
8588
+ theme: theme2
8589
+ }) => {
8590
+ return /* @__PURE__ */ jsxRuntime.jsx(Provider$2, { children: /* @__PURE__ */ jsxRuntime.jsx(InnerThemeProvider, { theme: theme2, children: children2 }) });
8585
8591
  };
8586
8592
  const isString$1 = (obj) => typeof obj === "string";
8587
8593
  const defer = () => {
@@ -24730,6 +24736,102 @@
24730
24736
  *
24731
24737
  * @license MIT
24732
24738
  */
24739
+ function createMemoryHistory(options2 = {}) {
24740
+ let { initialEntries = ["/"], initialIndex, v5Compat = false } = options2;
24741
+ let entries;
24742
+ entries = initialEntries.map(
24743
+ (entry, index22) => createMemoryLocation(
24744
+ entry,
24745
+ typeof entry === "string" ? null : entry.state,
24746
+ index22 === 0 ? "default" : void 0
24747
+ )
24748
+ );
24749
+ let index2 = clampIndex(
24750
+ initialIndex == null ? entries.length - 1 : initialIndex
24751
+ );
24752
+ let action = "POP";
24753
+ let listener = null;
24754
+ function clampIndex(n2) {
24755
+ return Math.min(Math.max(n2, 0), entries.length - 1);
24756
+ }
24757
+ function getCurrentLocation() {
24758
+ return entries[index2];
24759
+ }
24760
+ function createMemoryLocation(to, state = null, key) {
24761
+ let location = createLocation(
24762
+ entries ? getCurrentLocation().pathname : "/",
24763
+ to,
24764
+ state,
24765
+ key
24766
+ );
24767
+ warning(
24768
+ location.pathname.charAt(0) === "/",
24769
+ `relative pathnames are not supported in memory history: ${JSON.stringify(
24770
+ to
24771
+ )}`
24772
+ );
24773
+ return location;
24774
+ }
24775
+ function createHref2(to) {
24776
+ return typeof to === "string" ? to : createPath(to);
24777
+ }
24778
+ let history = {
24779
+ get index() {
24780
+ return index2;
24781
+ },
24782
+ get action() {
24783
+ return action;
24784
+ },
24785
+ get location() {
24786
+ return getCurrentLocation();
24787
+ },
24788
+ createHref: createHref2,
24789
+ createURL(to) {
24790
+ return new URL(createHref2(to), "http://localhost");
24791
+ },
24792
+ encodeLocation(to) {
24793
+ let path2 = typeof to === "string" ? parsePath(to) : to;
24794
+ return {
24795
+ pathname: path2.pathname || "",
24796
+ search: path2.search || "",
24797
+ hash: path2.hash || ""
24798
+ };
24799
+ },
24800
+ push(to, state) {
24801
+ action = "PUSH";
24802
+ let nextLocation = createMemoryLocation(to, state);
24803
+ index2 += 1;
24804
+ entries.splice(index2, entries.length, nextLocation);
24805
+ if (v5Compat && listener) {
24806
+ listener({ action, location: nextLocation, delta: 1 });
24807
+ }
24808
+ },
24809
+ replace(to, state) {
24810
+ action = "REPLACE";
24811
+ let nextLocation = createMemoryLocation(to, state);
24812
+ entries[index2] = nextLocation;
24813
+ if (v5Compat && listener) {
24814
+ listener({ action, location: nextLocation, delta: 0 });
24815
+ }
24816
+ },
24817
+ go(delta) {
24818
+ action = "POP";
24819
+ let nextIndex = clampIndex(index2 + delta);
24820
+ let nextLocation = entries[nextIndex];
24821
+ index2 = nextIndex;
24822
+ if (listener) {
24823
+ listener({ action, location: nextLocation, delta });
24824
+ }
24825
+ },
24826
+ listen(fn) {
24827
+ listener = fn;
24828
+ return () => {
24829
+ listener = null;
24830
+ };
24831
+ }
24832
+ };
24833
+ return history;
24834
+ }
24733
24835
  function invariant(value, message2) {
24734
24836
  if (value === false || value === null || typeof value === "undefined") {
24735
24837
  throw new Error(message2);
@@ -24744,6 +24846,24 @@
24744
24846
  }
24745
24847
  }
24746
24848
  }
24849
+ function createKey() {
24850
+ return Math.random().toString(36).substring(2, 10);
24851
+ }
24852
+ function createLocation(current, to, state = null, key) {
24853
+ let location = {
24854
+ pathname: typeof current === "string" ? current : current.pathname,
24855
+ search: "",
24856
+ hash: "",
24857
+ ...typeof to === "string" ? parsePath(to) : to,
24858
+ state,
24859
+ // TODO: This could be cleaned up. push/replace should probably just take
24860
+ // full Locations now and avoid the need to run through this flow at all
24861
+ // But that's a pretty big refactor to the current test suite so going to
24862
+ // keep as is for the time being and just let any incoming keys take precedence
24863
+ key: to && to.key || key || createKey()
24864
+ };
24865
+ return location;
24866
+ }
24747
24867
  function createPath({
24748
24868
  pathname = "/",
24749
24869
  search = "",
@@ -25621,6 +25741,100 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
25621
25741
  }) {
25622
25742
  return useRoutesImpl(routes, void 0, state, future);
25623
25743
  }
25744
+ function MemoryRouter({
25745
+ basename,
25746
+ children: children2,
25747
+ initialEntries,
25748
+ initialIndex
25749
+ }) {
25750
+ let historyRef = React__namespace.useRef();
25751
+ if (historyRef.current == null) {
25752
+ historyRef.current = createMemoryHistory({
25753
+ initialEntries,
25754
+ initialIndex,
25755
+ v5Compat: true
25756
+ });
25757
+ }
25758
+ let history = historyRef.current;
25759
+ let [state, setStateImpl] = React__namespace.useState({
25760
+ action: history.action,
25761
+ location: history.location
25762
+ });
25763
+ let setState = React__namespace.useCallback(
25764
+ (newState) => {
25765
+ React__namespace.startTransition(() => setStateImpl(newState));
25766
+ },
25767
+ [setStateImpl]
25768
+ );
25769
+ React__namespace.useLayoutEffect(() => history.listen(setState), [history, setState]);
25770
+ return /* @__PURE__ */ React__namespace.createElement(
25771
+ Router,
25772
+ {
25773
+ basename,
25774
+ children: children2,
25775
+ location: state.location,
25776
+ navigationType: state.action,
25777
+ navigator: history
25778
+ }
25779
+ );
25780
+ }
25781
+ function Router({
25782
+ basename: basenameProp = "/",
25783
+ children: children2 = null,
25784
+ location: locationProp,
25785
+ navigationType = "POP",
25786
+ navigator: navigator2,
25787
+ static: staticProp = false
25788
+ }) {
25789
+ invariant(
25790
+ !useInRouterContext(),
25791
+ `You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`
25792
+ );
25793
+ let basename = basenameProp.replace(/^\/*/, "/");
25794
+ let navigationContext = React__namespace.useMemo(
25795
+ () => ({
25796
+ basename,
25797
+ navigator: navigator2,
25798
+ static: staticProp,
25799
+ future: {}
25800
+ }),
25801
+ [basename, navigator2, staticProp]
25802
+ );
25803
+ if (typeof locationProp === "string") {
25804
+ locationProp = parsePath(locationProp);
25805
+ }
25806
+ let {
25807
+ pathname = "/",
25808
+ search = "",
25809
+ hash = "",
25810
+ state = null,
25811
+ key = "default"
25812
+ } = locationProp;
25813
+ let locationContext = React__namespace.useMemo(() => {
25814
+ let trailingPathname = stripBasename(pathname, basename);
25815
+ if (trailingPathname == null) {
25816
+ return null;
25817
+ }
25818
+ return {
25819
+ location: {
25820
+ pathname: trailingPathname,
25821
+ search,
25822
+ hash,
25823
+ state,
25824
+ key
25825
+ },
25826
+ navigationType
25827
+ };
25828
+ }, [basename, pathname, search, hash, state, key, navigationType]);
25829
+ warning(
25830
+ locationContext != null,
25831
+ `<Router basename="${basename}"> is not able to match the URL "${pathname}${search}${hash}" because it does not start with the basename, so the <Router> won't render anything.`
25832
+ );
25833
+ if (locationContext == null) {
25834
+ return null;
25835
+ }
25836
+ return /* @__PURE__ */ React__namespace.createElement(NavigationContext$1.Provider, { value: navigationContext }, /* @__PURE__ */ React__namespace.createElement(LocationContext.Provider, { children: children2, value: locationContext }));
25837
+ }
25624
25838
  var defaultMethod = "get";
25625
25839
  var defaultEncType = "application/x-www-form-urlencoded";
25626
25840
  function isHtmlElement(object) {
@@ -46735,7 +46949,7 @@ ${message2 ?? ""}`);
46735
46949
  ] })
46736
46950
  ] });
46737
46951
  };
46738
- const ViewAutomationModal = ({
46952
+ const ViewAutomationModalContent = ({
46739
46953
  iconDefinitions,
46740
46954
  autoOpenEditPopup,
46741
46955
  automationId,
@@ -46744,7 +46958,7 @@ ${message2 ?? ""}`);
46744
46958
  }) => {
46745
46959
  const params = useParams();
46746
46960
  const [searchParams] = useSearchParams();
46747
- const FINAL_AUTOMATION_ID = automationId || params.automationId || searchParams.get("automationId");
46961
+ const FINAL_AUTOMATION_ID = automationId || params?.automationId || searchParams.get("automationId");
46748
46962
  const AUTO_OPEN_EDIT_POPUP = autoOpenEditPopup || searchParams.get("autoOpenEditPopup");
46749
46963
  const FINAL_SHOW_BACK_BUTTON = searchParams.get("showBackButton") === "true" || showBackButton;
46750
46964
  const mergedIconDefinitions = mergeIconDefinitions(iconDefinitions);
@@ -46797,6 +47011,12 @@ ${message2 ?? ""}`);
46797
47011
  ] }) })
46798
47012
  ] });
46799
47013
  };
47014
+ const ViewAutomationModal = ({ inRouter = false, ...props }) => {
47015
+ if (inRouter) {
47016
+ return /* @__PURE__ */ jsxRuntime.jsx(ViewAutomationModalContent, { ...props });
47017
+ }
47018
+ return /* @__PURE__ */ jsxRuntime.jsx(MemoryRouter, { children: /* @__PURE__ */ jsxRuntime.jsx(ViewAutomationModalContent, { ...props }) });
47019
+ };
46800
47020
  var isNonNullable = (i2) => i2 != null;
46801
47021
  var filterNonNullable = (arr) => arr.filter(isNonNullable);
46802
47022
  function chain(callbacks) {