routelit-client 0.3.1 → 0.4.1

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.
@@ -2,5 +2,6 @@ declare const Checkbox: import("react").NamedExoticComponent<{
2
2
  label: string;
3
3
  checked: boolean;
4
4
  required?: boolean;
5
+ caption?: string;
5
6
  } & Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "onChange">>;
6
7
  export default Checkbox;
@@ -2,5 +2,5 @@ interface ImageProps extends React.HTMLAttributes<HTMLImageElement> {
2
2
  src: string;
3
3
  alt: string;
4
4
  }
5
- declare function Image({ src, alt, ...props }: ImageProps): import("react/jsx-runtime").JSX.Element;
5
+ declare function Image({ src, alt, children: _, ...props }: ImageProps): import("react/jsx-runtime").JSX.Element;
6
6
  export default Image;
@@ -1,4 +1,4 @@
1
- declare function TextInputComponent({ id, label, value, type, ...props }: {
1
+ declare function TextInputComponent({ id, label, value, type, children: _, ...props }: {
2
2
  id: string;
3
3
  label?: string;
4
4
  } & React.InputHTMLAttributes<HTMLInputElement>): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,8 @@
1
1
  export declare function applyAddAction(componentsTree: RouteLitComponent[], action: AddAction): void;
2
2
  export declare function applyRemoveAction(componentsTree: RouteLitComponent[], action: RemoveAction): void;
3
+ export declare function applySetAction(componentsTree: RouteLitComponent[], action: SetAction): void;
3
4
  export declare function applyUpdateAction(componentsTree: RouteLitComponent[], action: UpdateAction): void;
5
+ export declare function applyFreshBoundaryAction(componentsTree: RouteLitComponent[], action: FreshBoundaryAction): void;
6
+ export declare function removeStaleComponents(componentsTree: RouteLitComponent[]): void;
4
7
  export declare function prependAddressToActions(actionResponse: ActionsResponse, address: number[]): ActionsResponse;
5
8
  export declare function applyActions(componentsTree: RouteLitComponent[], actions: Action[]): void;
@@ -19,10 +19,17 @@ export declare class RouteLitManager {
19
19
  private address?;
20
20
  private lastURL?;
21
21
  private initialized;
22
+ private abortController?;
23
+ private actionAccumulator;
24
+ private currentTarget?;
25
+ private throttleTimer?;
26
+ private lastExecutionTime;
22
27
  constructor(props: RouteLitManagerProps);
23
28
  getLastURL: () => string;
24
29
  handleEvent: (e: CustomEvent<UIEventPayload>) => Promise<void>;
25
30
  handleError: (e: Error) => void;
31
+ batchAction: (action: Action, shouldNotify?: boolean) => void;
32
+ private flushActions;
26
33
  applyActions: (actionsResp: ActionsResponse, shouldNotify?: boolean) => void;
27
34
  private initializeDOM;
28
35
  initialize: () => void;
@@ -4,5 +4,5 @@ interface Props {
4
4
  manager: RouteLitManager;
5
5
  componentStore: ComponentStore;
6
6
  }
7
- declare function ReactRenderer({ manager, componentStore }: Props): import("react/jsx-runtime").JSX.Element;
7
+ declare function ReactRenderer({ manager, componentStore }: Props): import("react/jsx-runtime").JSX.Element | null;
8
8
  export default ReactRenderer;
@@ -1 +1,2 @@
1
- export declare function sendEvent(event: CustomEvent<UIEventPayload>, fragmentId?: string): Promise<ActionsResponse>;
1
+ export declare function sendEvent(event: CustomEvent<UIEventPayload>, fragmentId: string | undefined, abortController: AbortController): Promise<ActionsResponse>;
2
+ export declare function sendEventStream(event: CustomEvent<UIEventPayload>, fragmentId: string | undefined, abortController: AbortController): AsyncGenerator<ActionsResponse | Action>;
@@ -671,42 +671,92 @@ immer.setUseStrictShallowCopy.bind(immer);
671
671
  immer.applyPatches.bind(immer);
672
672
  immer.createDraft.bind(immer);
673
673
  immer.finishDraft.bind(immer);
674
- function applyAddAction(componentsTree, action) {
674
+ function getTarget(componentsTree, address) {
675
675
  let target = componentsTree;
676
- for (let i = 0; i < action.address.length - 1; i++) {
677
- if (!target[action.address[i]].children) {
678
- target[action.address[i]].children = [];
676
+ for (let i = 0; i < address.length - 1; i++) {
677
+ if (!target[address[i]].children) {
678
+ target[address[i]].children = [];
679
679
  }
680
- target = target[action.address[i]].children;
680
+ target = target[address[i]].children;
681
681
  }
682
+ return target;
683
+ }
684
+ function applyAddAction(componentsTree, action) {
685
+ const target = getTarget(componentsTree, action.address);
682
686
  target.splice(action.address[action.address.length - 1], 0, action.element);
683
687
  }
684
688
  function applyRemoveAction(componentsTree, action) {
685
- let target = componentsTree;
686
- for (let i = 0; i < action.address.length - 1; i++) {
687
- if (!target[action.address[i]].children) {
688
- target[action.address[i]].children = [];
689
- }
690
- target = target[action.address[i]].children;
691
- }
689
+ const target = getTarget(componentsTree, action.address);
692
690
  target.splice(action.address[action.address.length - 1], 1);
693
691
  }
692
+ function applySetAction(componentsTree, action) {
693
+ const target = getTarget(componentsTree, action.address);
694
+ const targetIndex = action.address[action.address.length - 1];
695
+ const oldElement = target[targetIndex];
696
+ if (oldElement && oldElement.children) {
697
+ action.element.children = oldElement.children;
698
+ }
699
+ target[targetIndex] = action.element;
700
+ if (action.element.stale) {
701
+ action.element.stale = void 0;
702
+ }
703
+ }
694
704
  function applyUpdateAction(componentsTree, action) {
695
- let target = componentsTree;
696
- for (let i = 0; i < action.address.length - 1; i++) {
697
- if (!target[action.address[i]].children) {
698
- target[action.address[i]].children = [];
705
+ const target = getTarget(componentsTree, action.address);
706
+ const element2 = target[action.address[action.address.length - 1]];
707
+ element2.props = action.props;
708
+ if (element2.stale) {
709
+ element2.stale = void 0;
710
+ }
711
+ }
712
+ function applyFreshBoundaryAction(componentsTree, action) {
713
+ const target = getTarget(componentsTree, action.address);
714
+ const staleStartsAt = action.address[action.address.length - 1] + 1;
715
+ const markLeafNodesStale = (components) => {
716
+ let staleCount = 0;
717
+ for (const component of components) {
718
+ if (!component.children || component.children.length === 0) {
719
+ component.stale = true;
720
+ staleCount++;
721
+ } else {
722
+ const childrenStaleCount = markLeafNodesStale(component.children);
723
+ if (childrenStaleCount === component.children.length) {
724
+ component.stale = true;
725
+ }
726
+ }
699
727
  }
700
- target = target[action.address[i]].children;
728
+ return staleCount;
729
+ };
730
+ const componentsToProcess = target.slice(staleStartsAt);
731
+ markLeafNodesStale(componentsToProcess);
732
+ }
733
+ function removeStaleComponents(componentsTree) {
734
+ var _a;
735
+ for (let i = componentsTree.length - 1; i >= 0; i--) {
736
+ const component = componentsTree[i];
737
+ if (component.stale) {
738
+ componentsTree.splice(i, 1);
739
+ } else if ((_a = component.children) == null ? void 0 : _a.length) {
740
+ removeStaleComponents(component.children);
741
+ }
742
+ }
743
+ }
744
+ function handleNoChangeAction(componentsTree, action) {
745
+ const target = getTarget(componentsTree, action.address);
746
+ const element2 = target[action.address[action.address.length - 1]];
747
+ if (element2.stale) {
748
+ element2.stale = void 0;
701
749
  }
702
- target[action.address[action.address.length - 1]].props = action.props;
750
+ }
751
+ function prependAddressToActionsArray(actionResponses, address) {
752
+ return actionResponses.map((action) => {
753
+ return { ...action, address: address.concat(action.address) };
754
+ });
703
755
  }
704
756
  function prependAddressToActions(actionResponse, address) {
705
757
  return {
706
758
  ...actionResponse,
707
- actions: actionResponse.actions.map((action) => {
708
- return { ...action, address: address.concat(action.address) };
709
- })
759
+ actions: prependAddressToActionsArray(actionResponse.actions, address)
710
760
  };
711
761
  }
712
762
  function applyActions(componentsTree, actions) {
@@ -718,19 +768,35 @@ function applyActions(componentsTree, actions) {
718
768
  case "remove":
719
769
  applyRemoveAction(componentsTree, action);
720
770
  break;
771
+ case "set":
772
+ applySetAction(componentsTree, action);
773
+ break;
721
774
  case "update":
722
775
  applyUpdateAction(componentsTree, action);
723
776
  break;
777
+ case "fresh_boundary":
778
+ applyFreshBoundaryAction(componentsTree, action);
779
+ break;
780
+ case "last":
781
+ removeStaleComponents(componentsTree);
782
+ break;
783
+ case "no_change":
784
+ handleNoChangeAction(componentsTree, action);
785
+ break;
724
786
  }
725
787
  });
726
788
  }
727
- async function sendEvent(event, fragmentId) {
789
+ async function* sendEventStream(event, fragmentId, abortController) {
728
790
  if (event.detail.type === "navigate") {
729
- return await handleNavigate(event);
791
+ yield* handleNavigateStream(
792
+ event,
793
+ abortController
794
+ );
795
+ return;
730
796
  }
731
- return await handleUIEvent(event, fragmentId);
797
+ yield* handleUIEventStream(event, fragmentId, abortController);
732
798
  }
733
- async function sendUIEvent(url, body, headers) {
799
+ async function* sendUIEventStream(url, body, headers, abortController) {
734
800
  const res = await fetch(url, {
735
801
  method: "POST",
736
802
  body: JSON.stringify(body),
@@ -738,14 +804,65 @@ async function sendUIEvent(url, body, headers) {
738
804
  "Content-Type": "application/json",
739
805
  ...headers
740
806
  },
741
- credentials: "include"
807
+ credentials: "include",
808
+ signal: abortController == null ? void 0 : abortController.signal
742
809
  });
743
810
  if (!res.ok) {
744
811
  throw new Error("Failed to send server event");
745
812
  }
746
- return res.json();
813
+ const contentType = res.headers.get("content-type") || "";
814
+ if (contentType.includes("application/jsonlines")) {
815
+ yield* parseJsonLinesStream(res);
816
+ } else {
817
+ const response = await res.json();
818
+ yield response;
819
+ }
820
+ }
821
+ function maybeParseJson(line) {
822
+ const trimmedLine = line.trim();
823
+ if (trimmedLine) {
824
+ try {
825
+ const jsonObject = JSON.parse(trimmedLine);
826
+ return jsonObject;
827
+ } catch (error) {
828
+ console.warn("Failed to parse final JSON chunk:", error);
829
+ }
830
+ }
831
+ return void 0;
747
832
  }
748
- async function handleUIEvent(event, fragmentId) {
833
+ async function* parseJsonLinesStream(response) {
834
+ var _a;
835
+ const reader = (_a = response.body) == null ? void 0 : _a.getReader();
836
+ if (!reader) {
837
+ throw new Error("Response body is not readable");
838
+ }
839
+ const decoder = new TextDecoder();
840
+ let buffer = "";
841
+ try {
842
+ while (true) {
843
+ const { done, value } = await reader.read();
844
+ if (done) {
845
+ const jsonObject = maybeParseJson(buffer);
846
+ if (jsonObject) {
847
+ yield jsonObject;
848
+ }
849
+ break;
850
+ }
851
+ buffer += decoder.decode(value, { stream: true });
852
+ const lines = buffer.split("\n");
853
+ buffer = lines.pop() || "";
854
+ for (const line of lines) {
855
+ const jsonObject = maybeParseJson(line);
856
+ if (jsonObject) {
857
+ yield jsonObject;
858
+ }
859
+ }
860
+ }
861
+ } finally {
862
+ reader.releaseLock();
863
+ }
864
+ }
865
+ async function* handleUIEventStream(event, fragmentId, abortController) {
749
866
  const { id, type, formId, ...data } = event.detail;
750
867
  const url = new URL(window.location.href);
751
868
  const body = {
@@ -757,9 +874,9 @@ async function handleUIEvent(event, fragmentId) {
757
874
  },
758
875
  fragmentId
759
876
  };
760
- return await sendUIEvent(url.toString(), body);
877
+ yield* sendUIEventStream(url.toString(), body, void 0, abortController);
761
878
  }
762
- async function handleNavigate(event) {
879
+ async function* handleNavigateStream(event, abortController) {
763
880
  const { href, id, type, lastURL, ...data } = event.detail;
764
881
  const body = {
765
882
  uiEvent: {
@@ -775,14 +892,15 @@ async function handleNavigate(event) {
775
892
  if (lastURL) {
776
893
  headers["X-Referer"] = lastURL;
777
894
  }
778
- const response = await sendUIEvent(href, body, headers);
895
+ yield* sendUIEventStream(href, body, headers, abortController);
779
896
  if (event.detail.replace) {
780
897
  window.history.replaceState(null, "", href);
781
898
  } else {
782
899
  window.history.pushState(null, "", href);
783
900
  }
784
- return response;
785
901
  }
902
+ const EMPTY_ARRAY = [];
903
+ const THROTTLE_DELAY = 125;
786
904
  class RouteLitManager {
787
905
  constructor(props) {
788
906
  __publicField(this, "listeners", []);
@@ -796,23 +914,45 @@ class RouteLitManager {
796
914
  __publicField(this, "address");
797
915
  __publicField(this, "lastURL");
798
916
  __publicField(this, "initialized", false);
917
+ __publicField(this, "abortController");
918
+ __publicField(this, "actionAccumulator", []);
919
+ __publicField(this, "currentTarget");
920
+ __publicField(this, "throttleTimer");
921
+ __publicField(this, "lastExecutionTime", 0);
799
922
  __publicField(this, "getLastURL", () => {
800
923
  var _a;
801
924
  return ((_a = this.parentManager) == null ? void 0 : _a.getLastURL()) ?? this.lastURL;
802
925
  });
803
926
  __publicField(this, "handleEvent", async (e) => {
804
- if (e.detail.type === "navigate" && this.fragmentId)
927
+ if (this.abortController) {
928
+ this.abortController.abort();
929
+ }
930
+ this.abortController = new AbortController();
931
+ if (e.detail.type === "navigate" && this.fragmentId) {
805
932
  return;
933
+ }
806
934
  if (e.detail.type === "navigate") {
807
935
  const detail = e.detail;
936
+ detail.lastURL = this.lastURL;
808
937
  this.lastURL = detail.href.startsWith("http") ? detail.href : window.location.origin + detail.href;
809
938
  }
810
939
  this._error = void 0;
811
940
  this._isLoading = true;
812
941
  this.notifyIsLoading();
813
942
  try {
814
- const response = await sendEvent(e, this.fragmentId);
815
- this.applyActions(response);
943
+ this.abortController = new AbortController();
944
+ const responseStream = sendEventStream(
945
+ e,
946
+ this.fragmentId,
947
+ this.abortController
948
+ );
949
+ for await (const response of responseStream) {
950
+ if ("type" in response) {
951
+ this.batchAction(response);
952
+ } else {
953
+ this.applyActions(response);
954
+ }
955
+ }
816
956
  } catch (error) {
817
957
  this.handleError(error);
818
958
  } finally {
@@ -825,6 +965,45 @@ class RouteLitManager {
825
965
  this._error = e;
826
966
  this.notifyError();
827
967
  });
968
+ __publicField(this, "batchAction", (action, shouldNotify = true) => {
969
+ var _a;
970
+ if (this.fragmentId && action.target === "app") {
971
+ (_a = this.parentManager) == null ? void 0 : _a.batchAction(action, shouldNotify);
972
+ return;
973
+ }
974
+ const targetKey = action.target || "fragment";
975
+ if (this.currentTarget && this.currentTarget !== targetKey) {
976
+ this.flushActions(shouldNotify);
977
+ }
978
+ this.currentTarget = targetKey;
979
+ this.actionAccumulator.push(action);
980
+ const now = Date.now();
981
+ if (now - this.lastExecutionTime >= THROTTLE_DELAY) {
982
+ this.flushActions(shouldNotify);
983
+ } else {
984
+ if (!this.throttleTimer) {
985
+ const remainingTime = THROTTLE_DELAY - (now - this.lastExecutionTime);
986
+ this.throttleTimer = setTimeout(() => {
987
+ this.flushActions(shouldNotify);
988
+ }, remainingTime);
989
+ }
990
+ }
991
+ });
992
+ __publicField(this, "flushActions", (shouldNotify) => {
993
+ if (this.actionAccumulator.length === 0 || !this.currentTarget) return;
994
+ if (this.throttleTimer) {
995
+ clearTimeout(this.throttleTimer);
996
+ this.throttleTimer = void 0;
997
+ }
998
+ this.lastExecutionTime = Date.now();
999
+ const actionsResponse = {
1000
+ actions: [...this.actionAccumulator],
1001
+ target: this.currentTarget
1002
+ };
1003
+ this.actionAccumulator = [];
1004
+ this.currentTarget = void 0;
1005
+ this.applyActions(actionsResponse, shouldNotify);
1006
+ });
828
1007
  __publicField(this, "applyActions", (actionsResp, shouldNotify = true) => {
829
1008
  var _a;
830
1009
  if (this.fragmentId) {
@@ -879,6 +1058,15 @@ class RouteLitManager {
879
1058
  document.dispatchEvent(navigateEvent);
880
1059
  });
881
1060
  __publicField(this, "terminate", () => {
1061
+ if (this.actionAccumulator.length > 0) {
1062
+ this.flushActions(true);
1063
+ }
1064
+ if (this.throttleTimer) {
1065
+ clearTimeout(this.throttleTimer);
1066
+ this.throttleTimer = void 0;
1067
+ }
1068
+ this.actionAccumulator = [];
1069
+ this.currentTarget = void 0;
882
1070
  document.removeEventListener(
883
1071
  "routelit:event",
884
1072
  this.handleEvent
@@ -891,9 +1079,9 @@ class RouteLitManager {
891
1079
  __publicField(this, "getComponentsTree", () => {
892
1080
  var _a;
893
1081
  if (this.address) {
894
- return ((_a = this.parentManager) == null ? void 0 : _a.getAtAddress(this.address)) ?? [];
1082
+ return ((_a = this.parentManager) == null ? void 0 : _a.getAtAddress(this.address)) ?? EMPTY_ARRAY;
895
1083
  }
896
- return this.componentsTree;
1084
+ return this.componentsTree ?? EMPTY_ARRAY;
897
1085
  });
898
1086
  __publicField(this, "isLoading", () => {
899
1087
  var _a;
@@ -1020,7 +1208,10 @@ function useFormId() {
1020
1208
  return context.id;
1021
1209
  }
1022
1210
  function Form({ id, children }) {
1023
- return /* @__PURE__ */ jsx(FormContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx("form", { id, "data-testid": id, children }) });
1211
+ function handleSubmit(e) {
1212
+ e.preventDefault();
1213
+ }
1214
+ return /* @__PURE__ */ jsx(FormContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx("form", { id, "data-testid": id, onSubmit: handleSubmit, children }) });
1024
1215
  }
1025
1216
  const RouteLitContext = createContext({
1026
1217
  manager: void 0,
@@ -1094,26 +1285,38 @@ function useError() {
1094
1285
  manager2.getError
1095
1286
  );
1096
1287
  }
1288
+ function getElement(name2, key, address, props, children, componentStore2) {
1289
+ if (name2 === "fragment") {
1290
+ return /* @__PURE__ */ jsx(Fragment, { id: props.id, address }, key);
1291
+ }
1292
+ const Component = componentStore2.get(name2);
1293
+ if (!Component) return null;
1294
+ return /* @__PURE__ */ jsx(Component, { id: key, ...props, children: children == null ? void 0 : children.map(renderComponentTree(componentStore2)) }, key);
1295
+ }
1296
+ function FinalComponent({
1297
+ c,
1298
+ componentStore: componentStore2
1299
+ }) {
1300
+ const element2 = useMemo(
1301
+ () => getElement(c.name, c.key, c.address, c.props, c.children, componentStore2),
1302
+ [c.name, c.key, c.address, c.props, c.children, componentStore2]
1303
+ );
1304
+ const className = c.stale ? "rl-component rl-stale" : "rl-component";
1305
+ return /* @__PURE__ */ jsx("div", { className, children: element2 });
1306
+ }
1307
+ const renderComponentTree = (componentStore2) => (c) => {
1308
+ return /* @__PURE__ */ jsx(FinalComponent, { c, componentStore: componentStore2 }, c.key);
1309
+ };
1097
1310
  function ReactRenderer({ manager: manager2, componentStore: componentStore2 }) {
1098
1311
  const componentsTree = useSyncExternalStore(
1099
1312
  manager2.subscribe,
1100
1313
  manager2.getComponentsTree
1101
1314
  );
1102
- useSyncExternalStore(
1103
- componentStore2.subscribe,
1104
- componentStore2.getVersion
1105
- );
1106
- const renderComponentTree = (c) => {
1107
- var _a;
1108
- const Component = componentStore2.get(c.name);
1109
- if (!Component) return null;
1110
- if (c.name === "fragment") {
1111
- const { id, ...props } = c.props;
1112
- return /* @__PURE__ */ jsx(Fragment, { id, address: c.address, ...props }, c.key);
1113
- }
1114
- return /* @__PURE__ */ jsx(Component, { id: c.key, ...c.props, children: (_a = c.children) == null ? void 0 : _a.map(renderComponentTree) }, c.key);
1115
- };
1116
- return /* @__PURE__ */ jsx("div", { className: "rl-container", children: componentsTree.map(renderComponentTree) });
1315
+ useSyncExternalStore(componentStore2.subscribe, componentStore2.getVersion);
1316
+ if (!(componentsTree == null ? void 0 : componentsTree.length)) {
1317
+ return null;
1318
+ }
1319
+ return /* @__PURE__ */ jsx("div", { className: "rl-container", children: componentsTree == null ? void 0 : componentsTree.map(renderComponentTree(componentStore2)) });
1117
1320
  }
1118
1321
  function Fragment({ id, address }) {
1119
1322
  const { componentStore: componentStore2, manager: parentManager } = useRouteLitContext();
@@ -20671,7 +20874,7 @@ function Markdown({ body, allowUnsafeHtml = false }) {
20671
20874
  );
20672
20875
  return /* @__PURE__ */ jsx(Markdown$1, { rehypePlugins, children: body });
20673
20876
  }
20674
- function Image({ src, alt, ...props }) {
20877
+ function Image({ src, alt, children: _, ...props }) {
20675
20878
  return /* @__PURE__ */ jsx("img", { src, alt, ...props });
20676
20879
  }
20677
20880
  const Button = memo(function Button2({
@@ -20681,21 +20884,8 @@ const Button = memo(function Button2({
20681
20884
  ...props
20682
20885
  }) {
20683
20886
  const dispatch = useFormDispatcher(id, eventName);
20684
- const isLoading = useIsLoading();
20685
- const handleClick = useCallback(() => {
20686
- dispatch({});
20687
- }, [dispatch]);
20688
- return /* @__PURE__ */ jsx(
20689
- "button",
20690
- {
20691
- id,
20692
- type: "button",
20693
- disabled: isLoading,
20694
- ...props,
20695
- onClick: handleClick,
20696
- children: text2
20697
- }
20698
- );
20887
+ const handleClick = useCallback(() => dispatch({}), [dispatch]);
20888
+ return /* @__PURE__ */ jsx("button", { id, type: "button", ...props, onClick: handleClick, children: text2 });
20699
20889
  });
20700
20890
  Button.displayName = "Button";
20701
20891
  const Expander = ({
@@ -20726,10 +20916,10 @@ const Checkbox = memo(function Checkbox2({
20726
20916
  checked,
20727
20917
  id,
20728
20918
  required,
20919
+ children: _,
20729
20920
  ...props
20730
20921
  }) {
20731
20922
  const dispatchChange = useFormDispatcherWithAttr(id, "change", "checked");
20732
- const isLoading = useIsLoading();
20733
20923
  const onChange = useCallback(
20734
20924
  (e) => {
20735
20925
  dispatchChange(e.target.checked);
@@ -20741,7 +20931,6 @@ const Checkbox = memo(function Checkbox2({
20741
20931
  "input",
20742
20932
  {
20743
20933
  ...props,
20744
- disabled: isLoading || props.disabled,
20745
20934
  type: "checkbox",
20746
20935
  id,
20747
20936
  checked,
@@ -20758,13 +20947,13 @@ const Checkbox = memo(function Checkbox2({
20758
20947
  });
20759
20948
  Checkbox.displayName = "Checkbox";
20760
20949
  function CheckboxGroupOption(props) {
20761
- const { id, value, onChange, isLoading } = props;
20950
+ const { id, value, onChange } = props;
20762
20951
  const option = typeof props.option === "string" ? { label: props.option, value: props.option } : props.option;
20763
20952
  return /* @__PURE__ */ jsxs("div", { className: "rl-form-flex-control", children: [
20764
20953
  /* @__PURE__ */ jsx(
20765
20954
  "input",
20766
20955
  {
20767
- disabled: isLoading || option.disabled,
20956
+ disabled: option.disabled,
20768
20957
  type: "checkbox",
20769
20958
  value: option.value,
20770
20959
  id: `${id}-${option.value}`,
@@ -20787,7 +20976,6 @@ const CheckboxGroup = memo(function CheckboxGroup2({
20787
20976
  flexDirection = "col"
20788
20977
  }) {
20789
20978
  const dispatchChange = useFormDispatcherWithAttr(id, "change", "value");
20790
- const isLoading = useIsLoading();
20791
20979
  const onChange = useCallback(
20792
20980
  (e) => {
20793
20981
  const newValue = e.target.checked ? [...value, e.target.value] : value.filter((v) => v !== e.target.value);
@@ -20807,7 +20995,6 @@ const CheckboxGroup = memo(function CheckboxGroup2({
20807
20995
  id,
20808
20996
  value,
20809
20997
  onChange,
20810
- isLoading,
20811
20998
  option
20812
20999
  },
20813
21000
  typeof option === "string" ? option : option.value
@@ -20845,9 +21032,9 @@ function TextInputComponent({
20845
21032
  label,
20846
21033
  value,
20847
21034
  type = "text",
21035
+ children: _,
20848
21036
  ...props
20849
21037
  }) {
20850
- const isLoading = useIsLoading();
20851
21038
  const dispatchChange = useFormDispatcherWithAttr(id, "change", "value");
20852
21039
  const lastValueRef = useRef(value);
20853
21040
  function handleChange(newValue) {
@@ -20877,7 +21064,6 @@ function TextInputComponent({
20877
21064
  type,
20878
21065
  id,
20879
21066
  ...props,
20880
- disabled: isLoading || props.disabled,
20881
21067
  onBlur: handleBlur,
20882
21068
  onKeyDown: handleKeyDown,
20883
21069
  defaultValue: value
@@ -20888,13 +21074,13 @@ function TextInputComponent({
20888
21074
  const TextInput = memo(TextInputComponent);
20889
21075
  TextInput.displayName = "TextInput";
20890
21076
  function RadioGroupOption(props) {
20891
- const { id, value, onChange, isLoading } = props;
21077
+ const { id, value, onChange } = props;
20892
21078
  const option = typeof props.option === "string" ? { label: props.option, value: props.option } : props.option;
20893
21079
  return /* @__PURE__ */ jsxs("div", { className: "rl-form-flex-control", children: [
20894
21080
  /* @__PURE__ */ jsx(
20895
21081
  "input",
20896
21082
  {
20897
- disabled: isLoading || option.disabled,
21083
+ disabled: option.disabled,
20898
21084
  type: "radio",
20899
21085
  value: option.value,
20900
21086
  id: `${id}-${option.value}`,
@@ -20917,7 +21103,6 @@ const RadioGroup = memo(function RadioGroup2({
20917
21103
  flexDirection = "col"
20918
21104
  }) {
20919
21105
  const dispatchChange = useFormDispatcherWithAttr(id, "change", "value");
20920
- const isLoading = useIsLoading();
20921
21106
  const onChange = useCallback(
20922
21107
  (e) => {
20923
21108
  dispatchChange(e.target.value);
@@ -20936,7 +21121,6 @@ const RadioGroup = memo(function RadioGroup2({
20936
21121
  id,
20937
21122
  value,
20938
21123
  onChange,
20939
- isLoading,
20940
21124
  option
20941
21125
  },
20942
21126
  typeof option === "string" ? option : option.value
@@ -20954,9 +21138,9 @@ const Select = memo(function Select2({
20954
21138
  required,
20955
21139
  value,
20956
21140
  options,
21141
+ children: _,
20957
21142
  ...props
20958
21143
  }) {
20959
- const isLoading = useIsLoading();
20960
21144
  const dispatchChange = useFormDispatcherWithAttr(id, "change", "value");
20961
21145
  const lastValueRef = useRef(value);
20962
21146
  function handleChange(e) {
@@ -20977,10 +21161,9 @@ const Select = memo(function Select2({
20977
21161
  {
20978
21162
  id,
20979
21163
  value,
20980
- onChange: handleChange,
20981
21164
  ...props,
20982
- disabled: isLoading,
20983
21165
  required,
21166
+ onChange: handleChange,
20984
21167
  children: options.map((option) => /* @__PURE__ */ jsx(
20985
21168
  SelectOption,
20986
21169
  {
@@ -20999,7 +21182,6 @@ function TextareaComponent({
20999
21182
  value,
21000
21183
  ...props
21001
21184
  }) {
21002
- const isLoading = useIsLoading();
21003
21185
  const dispatchChange = useFormDispatcherWithAttr(id, "change", "value");
21004
21186
  const lastValueRef = useRef(value);
21005
21187
  function handleChange(newValue) {
@@ -21028,7 +21210,6 @@ function TextareaComponent({
21028
21210
  {
21029
21211
  id,
21030
21212
  ...props,
21031
- disabled: isLoading || props.disabled,
21032
21213
  onBlur: handleBlur,
21033
21214
  onKeyDown: handleKeyDown,
21034
21215
  defaultValue: value