@mittwald/flow-react-components 0.1.0-alpha.142 → 0.1.0-alpha.144

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.
Files changed (116) hide show
  1. package/dist/{Accordion-QhhkJhTO.js → Accordion-S70SYWwS.js} +3 -3
  2. package/dist/Accordion.js +1 -1
  3. package/dist/Action-SzQtjRB5.js +288 -0
  4. package/dist/Action.js +1 -1
  5. package/dist/ActionGroup.js +1 -1
  6. package/dist/Avatar.js +1 -1
  7. package/dist/Breadcrumb.js +2 -2
  8. package/dist/{Button-BS1F0zPs.js → Button-Bs4J6es6.js} +5 -5
  9. package/dist/Button.js +1 -1
  10. package/dist/{Checkbox-CD6v6jqo.js → Checkbox-zg7icNVe.js} +4 -4
  11. package/dist/Checkbox.js +1 -1
  12. package/dist/{CheckboxButton-I0WYBLv2.js → CheckboxButton-CbLlDhsH.js} +2 -2
  13. package/dist/CheckboxButton.js +1 -1
  14. package/dist/CheckboxGroup.js +3 -3
  15. package/dist/{Content-DlB-BYko.js → Content-arM8nm8H.js} +1 -1
  16. package/dist/Content.js +1 -1
  17. package/dist/ContextMenu.js +3 -3
  18. package/dist/ContextMenuTrigger-CeyI6LLR.js +55 -0
  19. package/dist/ContextualHelp.js +31 -22
  20. package/dist/CopyButton.js +5 -5
  21. package/dist/CounterBadge.js +1 -1
  22. package/dist/{FieldDescription-Brg52RqE.js → FieldDescription-jVeMFUA3.js} +2 -2
  23. package/dist/FieldDescription.js +1 -1
  24. package/dist/{FieldError-D_VRyiJG.js → FieldError-eiEmcuuK.js} +3 -3
  25. package/dist/FieldError.js +1 -1
  26. package/dist/{Header-BetbThNR.js → Header-DAaa854y.js} +1 -1
  27. package/dist/Header.js +1 -1
  28. package/dist/{Heading-CfQzGjxY.js → Heading-ob3LPLN8.js} +1 -1
  29. package/dist/Heading.js +1 -1
  30. package/dist/{Icon-D4bkU_pz.js → Icon-CvhSELPq.js} +1 -1
  31. package/dist/Icon.js +1 -1
  32. package/dist/{IconCheck-CMWmQYpS.js → IconCheck-Bx3sPenK.js} +1 -1
  33. package/dist/{IconCheckboxEmpty-DQLeOSmS.js → IconCheckboxEmpty-CzAVypP3.js} +1 -1
  34. package/dist/{IconCheckboxIndeterminate-DoNQre-9.js → IconCheckboxIndeterminate-CKiaFL3c.js} +1 -1
  35. package/dist/{IconChevronDown-HLDPe1kj.js → IconChevronDown-BjpRbARt.js} +1 -1
  36. package/dist/{IconChevronRight-DmCZeDFh.js → IconChevronRight-BKNi_Ug_.js} +1 -1
  37. package/dist/{IconChevronUp-CUKpaGeP.js → IconChevronUp-D1VuNDfJ.js} +1 -1
  38. package/dist/{IconClose-FTrJdf_N.js → IconClose-DVwhXp3R.js} +1 -1
  39. package/dist/{IconContextMenu-Bmk1_j_0.js → IconContextMenu-B7agrmqo.js} +1 -1
  40. package/dist/{IconCopy-DH_CNzXF.js → IconCopy-D2sPjH5b.js} +1 -1
  41. package/dist/{IconDanger-PwvUWqzQ.js → IconDanger-C-H0zYrp.js} +1 -1
  42. package/dist/{IconInfo-Dzy8qZId.js → IconInfo-DDhh409U.js} +1 -1
  43. package/dist/{IconPending-BV7TXz8_.js → IconPending-DCgEsvHk.js} +1 -1
  44. package/dist/{IconPlus-CAQpgAH5.js → IconPlus-Uxpaa4X_.js} +1 -1
  45. package/dist/{IconRadioOn-BIS8wd64.js → IconRadioOn-8P7k8SVa.js} +1 -1
  46. package/dist/{IconSearch-DadOOeXe.js → IconSearch-DAPXXri4.js} +1 -1
  47. package/dist/{IconSucceeded-KKiDIenP.js → IconSucceeded-YONbnUQb.js} +1 -1
  48. package/dist/{IconWarning-DHYHv9V-.js → IconWarning-zl3wRgfI.js} +1 -1
  49. package/dist/Icons.js +18 -18
  50. package/dist/Image.js +1 -1
  51. package/dist/Initials.js +1 -1
  52. package/dist/InlineAlert.js +2 -2
  53. package/dist/{Label-5xy35UpX.js → Label-25wKJcpL.js} +1 -1
  54. package/dist/Label.js +1 -1
  55. package/dist/LayoutCard.js +1 -1
  56. package/dist/{Link-CcYCy_KC.js → Link-Bal042NI.js} +1 -1
  57. package/dist/Link.js +1 -1
  58. package/dist/List.js +15 -17
  59. package/dist/{LoadingSpinner-CoSM7GIL.js → LoadingSpinner-bd5Is2yg.js} +2 -2
  60. package/dist/LoadingSpinner.js +1 -1
  61. package/dist/{MenuItem-Dny58Rqq.js → MenuItem-CCEquV9i.js} +5 -5
  62. package/dist/MenuItem.js +1 -1
  63. package/dist/Modal.js +15 -12
  64. package/dist/{ModalOverlay-BSu4UEnW.js → ModalOverlay-TJdwgPq0.js} +12 -11
  65. package/dist/Navigation.js +2 -2
  66. package/dist/Notification.js +5 -5
  67. package/dist/NumberField.js +7 -7
  68. package/dist/OffCanvas.js +40 -26
  69. package/dist/OverlayContextProvider-BBz2Hde8.js +20 -0
  70. package/dist/OverlayTrigger-DpALSyS8.js +20 -0
  71. package/dist/Popover-DrXvRfAg.js +44 -0
  72. package/dist/RadioGroup.js +5 -5
  73. package/dist/Section.js +1 -1
  74. package/dist/Select.js +59 -54
  75. package/dist/Slider.js +4 -4
  76. package/dist/StatusBadge.js +3 -3
  77. package/dist/{StatusIcon-J28z-uQ4.js → StatusIcon-YOrSQbPf.js} +4 -4
  78. package/dist/StatusIcon.js +1 -1
  79. package/dist/Switch.js +5 -5
  80. package/dist/Tabs.js +7 -7
  81. package/dist/{Text-D6e-S6em.js → Text-BgxTAtk1.js} +1 -1
  82. package/dist/Text.js +1 -1
  83. package/dist/TextArea.js +2 -2
  84. package/dist/TextField.js +2 -2
  85. package/dist/{TextFieldBase-Ciy6scGP.js → TextFieldBase-HHASqigh.js} +2 -2
  86. package/dist/context-Bdh6m_8S.js +44 -0
  87. package/dist/controller.js +4 -3
  88. package/dist/{flowComponent-CPKCCJEg.js → flowComponent-CWmvUeHT.js} +5 -2
  89. package/dist/hooks.js +1 -1
  90. package/dist/react-hook-form.js +2 -2
  91. package/dist/types/components/Action/models/ActionModel.d.ts +5 -3
  92. package/dist/types/components/Action/types.d.ts +4 -3
  93. package/dist/types/components/ContextMenu/components/ContextMenuTrigger/ContextMenuTrigger.d.ts +3 -2
  94. package/dist/types/components/ContextualHelp/ContextualHelp.d.ts +2 -2
  95. package/dist/types/components/ContextualHelp/components/ContextualHelpTrigger/ContextualHelpTrigger.d.ts +3 -2
  96. package/dist/types/components/Modal/components/ModalTrigger/ModalTrigger.d.ts +3 -2
  97. package/dist/types/components/OffCanvas/OffCanvas.d.ts +4 -3
  98. package/dist/types/components/OffCanvas/components/OffCanvasTrigger/OffCanvasTrigger.d.ts +3 -2
  99. package/dist/types/components/OverlayTrigger/OverlayTrigger.d.ts +6 -3
  100. package/dist/types/components/OverlayTrigger/OverlayTrigger.test.d.ts +1 -0
  101. package/dist/types/components/Popover/Popover.d.ts +1 -1
  102. package/dist/types/components/Popover/components/PopoverTrigger/PopoverTrigger.d.ts +3 -2
  103. package/dist/types/components/Select/Select.d.ts +2 -0
  104. package/dist/types/components/propTypes/index.d.ts +6 -0
  105. package/dist/types/lib/controller/overlay/OverlayContextProvider.d.ts +10 -0
  106. package/dist/types/lib/controller/overlay/context.d.ts +49 -2
  107. package/dist/types/lib/controller/overlay/useOverlayController.d.ts +2 -1
  108. package/dist/types/lib/propsContext/propsContext.d.ts +6 -0
  109. package/dist/types/lib/slotContext/slotContext.d.ts +3 -0
  110. package/dist/useOverlayController-C88Gnnhi.js +10 -0
  111. package/package.json +4 -4
  112. package/dist/Action-C4Ncwjzf.js +0 -287
  113. package/dist/ContextMenuTrigger-DjZx2IST.js +0 -52
  114. package/dist/OverlayTrigger-DbjMkqKf.js +0 -20
  115. package/dist/Popover-B-COTLld.js +0 -41
  116. package/dist/useOverlayController-CGKumeGL.js +0 -49
@@ -1,287 +0,0 @@
1
- "use client"
2
- /* */
3
- var B = Object.defineProperty;
4
- var k = (o, t, e) => t in o ? B(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
5
- var r = (o, t, e) => (k(o, typeof t != "symbol" ? t + "" : t, e), e);
6
- import w, { createContext as M, useRef as O, useContext as b } from "react";
7
- import { makeObservable as I, observable as E, action as D, computed as T } from "mobx";
8
- import { u as g } from "./useOverlayController-CGKumeGL.js";
9
- import N from "invariant";
10
- import { u as v } from "./useSelector-DpU7_HMO.js";
11
- import { a as R, g as V, u as $ } from "./getActionGroupSlot-Do-bk4GU.js";
12
- import "./propsContext-DzAKlmhS.js";
13
- import { P as G } from "./PropsContextProvider-C6Z4XGp6.js";
14
- import "@react-aria/utils";
15
- import "remeda";
16
- import { d as u } from "./dynamic-ClpUSmEt.js";
17
- import { u as L } from "./slotContext-DoCFkzCA.js";
18
- const C = M(void 0), U = C.Provider, x = (o) => new Promise((t) => setTimeout(t, o)), p = {
19
- pending: 1e3,
20
- succeeded: 1500,
21
- failed: 2e3
22
- };
23
- class y {
24
- constructor() {
25
- r(this, "showFeedback");
26
- r(this, "state", "isIdle");
27
- r(this, "setPendingTimeout");
28
- r(this, "error");
29
- r(this, "isAsync", !1);
30
- I(this, {
31
- state: E,
32
- updateState: D,
33
- isBusy: T
34
- });
35
- }
36
- static useNew() {
37
- return O(new y()).current;
38
- }
39
- updateState(t) {
40
- this.state = t;
41
- }
42
- useValue() {
43
- return v(() => this.state, [this]);
44
- }
45
- useIsBusy() {
46
- return v(() => this.isBusy, [this]);
47
- }
48
- get isBusy() {
49
- return this.state !== "isIdle";
50
- }
51
- onAsyncStart() {
52
- this.isAsync = !0, this.updateState("isExecuting"), this.setPendingTimeout = window.setTimeout(
53
- () => this.startPending(),
54
- p.pending
55
- );
56
- }
57
- async onSucceeded() {
58
- await this.onDone();
59
- }
60
- async onFailed(t) {
61
- this.error = t ?? new Error("Unknown error"), await this.onDone();
62
- }
63
- withFeedback(t) {
64
- return this.showFeedback = t, this;
65
- }
66
- async startFailedFeedback() {
67
- this.updateState("isFailed"), await x(p.failed), this.resetAfterDone();
68
- }
69
- async startSucceededFeedback() {
70
- this.updateState("isSucceeded"), await x(p.succeeded), this.resetAfterDone();
71
- }
72
- resetAfterDone() {
73
- this.updateState("isIdle"), this.isAsync = !1, this.error = void 0;
74
- }
75
- async onDone() {
76
- this.setPendingTimeout && window.clearTimeout(this.setPendingTimeout), this.error ? await this.startFailedFeedback() : this.showFeedback !== !1 && (this.showFeedback || this.isAsync) ? await this.startSucceededFeedback() : this.resetAfterDone();
77
- }
78
- startPending() {
79
- this.updateState("isPending");
80
- }
81
- }
82
- const F = (o) => (...t) => {
83
- const e = [...o], n = e.shift();
84
- if (n) {
85
- const s = n(...t), a = () => e.length === 0 ? s : F(e)(...t);
86
- return s instanceof Promise ? s.then(a) : a();
87
- }
88
- }, d = () => {
89
- }, j = (o, t = {}) => {
90
- const {
91
- onSync: e = d,
92
- onAsync: n = d,
93
- then: s = d,
94
- catch: a = d,
95
- finally: c = d
96
- } = t;
97
- try {
98
- const i = o();
99
- return i instanceof Promise ? (n(), i.then(s).catch(a).finally(c)) : (e(), s(i), c(), i);
100
- } catch (i) {
101
- e(), a(i), c();
102
- }
103
- }, q = () => {
104
- };
105
- function z(o) {
106
- if (o.needsConfirmation)
107
- return o.confirmationModalController.open;
108
- const t = o.getOverlayController(), {
109
- action: e,
110
- toggleOverlay: n,
111
- closeOverlay: s,
112
- openOverlay: a
113
- } = o.actionProps;
114
- return e || (a && t ? t.open : s && t || n && t ? t.close : q);
115
- }
116
- class P {
117
- constructor(t) {
118
- r(this, "actions", []);
119
- r(this, "baseAction");
120
- this.baseAction = t;
121
- }
122
- addAction(t) {
123
- this.actions.push(t);
124
- }
125
- async executeBatch(t) {
126
- if (this.actions.length === 0)
127
- return;
128
- const e = this.actions[this.actions.length - 1].actionProps.showFeedback, n = this.baseAction.state.withFeedback(
129
- this.baseAction.needsConfirmation ? !1 : e
130
- ), s = this.actions.map((i) => z(i)), a = F(s);
131
- let c;
132
- if (await j(() => a(...t), {
133
- onAsync: () => n.onAsyncStart(),
134
- then: () => n.onSucceeded(),
135
- catch: (i) => {
136
- n.onFailed(i), c = i;
137
- }
138
- }), c)
139
- throw c;
140
- }
141
- }
142
- class H {
143
- constructor(t) {
144
- r(this, "action");
145
- r(this, "execute", (...t) => {
146
- const e = this.getBatchedActions();
147
- (async () => {
148
- for (const s of e)
149
- await s.executeBatch(t);
150
- })().catch((s) => console.error(s));
151
- });
152
- r(this, "getBatchedActions", () => {
153
- let t = this.action;
154
- const e = [];
155
- let n = new P(
156
- this.action
157
- ), s = 0;
158
- for (; t; ) {
159
- const { action: a, break: c, skip: i } = t.actionProps;
160
- if (t.needsConfirmation) {
161
- n.addAction(t);
162
- break;
163
- }
164
- if (i) {
165
- s = i === !0 ? 1 : i, t = t.parentAction;
166
- continue;
167
- }
168
- if (s > 0) {
169
- t = t.parentAction, s--;
170
- continue;
171
- }
172
- if (c)
173
- break;
174
- a || (e.push(n), n = new P(this.action)), n.addAction(t), t = t.parentAction;
175
- }
176
- return e.push(n), e;
177
- });
178
- this.action = t;
179
- }
180
- }
181
- class l {
182
- constructor(t) {
183
- r(this, "state");
184
- r(this, "needsConfirmation");
185
- r(this, "actionProps");
186
- r(this, "parentAction");
187
- r(this, "confirmationModalController");
188
- r(this, "overlayController");
189
- r(this, "execute", (...t) => {
190
- new H(this).execute(...t);
191
- });
192
- const {
193
- actionProps: e,
194
- needsConfirmation: n,
195
- parentAction: s,
196
- overlayController: a,
197
- confirmationModalController: c,
198
- state: i
199
- } = t;
200
- this.actionProps = e, this.parentAction = s, this.confirmationModalController = c, this.needsConfirmation = n, this.overlayController = a, this.state = i;
201
- }
202
- static useNew(t, e = {}) {
203
- const n = b(C), s = g(), a = g(), c = y.useNew();
204
- return new l({
205
- parentAction: n,
206
- overlayController: s,
207
- confirmationModalController: a,
208
- needsConfirmation: !1,
209
- actionProps: t,
210
- state: c,
211
- ...e
212
- });
213
- }
214
- static use() {
215
- const t = b(C);
216
- return N(!!t, "Action context is not defined"), R.useRegisterState(t.state), t;
217
- }
218
- static useConfirmationAction() {
219
- const t = l.use();
220
- return new l({
221
- actionProps: t.actionProps,
222
- confirmationModalController: t.confirmationModalController,
223
- overlayController: t.overlayController,
224
- state: t.state,
225
- needsConfirmation: !1,
226
- parentAction: l.useNew(
227
- {
228
- closeOverlay: !0
229
- },
230
- {
231
- parentAction: t.parentAction
232
- }
233
- )
234
- });
235
- }
236
- getOverlayController() {
237
- const t = (e) => e === void 0 ? void 0 : e === !0 ? this.overlayController : e === !1 ? void 0 : e;
238
- return t(this.actionProps.openOverlay) ?? t(this.actionProps.closeOverlay) ?? t(this.actionProps.toggleOverlay);
239
- }
240
- }
241
- const J = (o) => L()[o], A = (o) => J("Modal") === "actionConfirm" ? V(o) : void 0, f = (o) => {
242
- const t = l.use(), e = t.state.useValue(), n = A(o) === "primary", s = t.confirmationModalController.useIsOpen();
243
- return t.needsConfirmation && s && !n ? "isIdle" : e;
244
- }, S = {
245
- onPress: u((o) => {
246
- const t = l.use(), e = l.useConfirmationAction(), n = A(o) === "primary";
247
- return A(o) === "abort" ? t.confirmationModalController.close : n ? e.execute : t.execute;
248
- }),
249
- isPending: u((o) => f(o) === "isPending"),
250
- isSucceeded: u(
251
- (o) => f(o) === "isSucceeded"
252
- ),
253
- isFailed: u((o) => f(o) === "isFailed"),
254
- "aria-disabled": u((o) => {
255
- const t = f(o), e = $().useIsBusy();
256
- return t === "isExecuting" || e;
257
- })
258
- }, rt = (o) => {
259
- const { children: t, actionModel: e, ...n } = o, s = l.useNew(n), a = e ?? s, c = {
260
- Button: S,
261
- Link: {
262
- onPress: u(() => l.use().execute)
263
- },
264
- Modal: {
265
- slot: u((i) => {
266
- const { slot: m } = i, h = l.use();
267
- return h.needsConfirmation = m === "actionConfirm", m;
268
- }),
269
- isDismissable: u((i) => {
270
- const h = l.use().state.useValue();
271
- return h === "isExecuting" || h === "isPending" ? !1 : i.isDismissable;
272
- }),
273
- controller: u(() => {
274
- const i = l.use();
275
- return i.needsConfirmation ? i.confirmationModalController : i.getOverlayController();
276
- }),
277
- ActionGroup: {
278
- Button: S
279
- }
280
- }
281
- };
282
- return /* @__PURE__ */ w.createElement(U, { value: a }, /* @__PURE__ */ w.createElement(G, { props: c, mergeInParentContext: !0 }, t));
283
- };
284
- export {
285
- rt as A,
286
- l as a
287
- };
@@ -1,52 +0,0 @@
1
- "use client"
2
- /* */
3
- import e from "react";
4
- import * as r from "react-aria-components";
5
- import { f as M } from "./flowComponent-CPKCCJEg.js";
6
- import { P as d } from "./Popover-B-COTLld.js";
7
- import "mobx";
8
- import "./useOverlayController-CGKumeGL.js";
9
- import { C as g } from "./ClearPropsContext-CUvsbMn8.js";
10
- import { P as C } from "./PropsContextProvider-C6Z4XGp6.js";
11
- import "@react-aria/utils";
12
- import "./propsContext-DzAKlmhS.js";
13
- import "remeda";
14
- import { O as v } from "./OverlayTrigger-DbjMkqKf.js";
15
- const P = "flow--context-menu", E = "flow--context-menu--popover", n = {
16
- contextMenu: P,
17
- popover: E
18
- }, R = M("ContextMenu", (o) => {
19
- const {
20
- children: a,
21
- onAction: s,
22
- selectionMode: t,
23
- selectedKeys: i,
24
- defaultSelectedKeys: c,
25
- disabledKeys: l,
26
- onSelectionChange: m,
27
- refProp: p,
28
- ...u
29
- } = o, f = t === "navigation" ? "single" : t, x = {
30
- MenuItem: {
31
- selectionVariant: t === "navigation" ? "navigation" : "control"
32
- }
33
- };
34
- return /* @__PURE__ */ e.createElement(g, null, /* @__PURE__ */ e.createElement(d, { ...u, className: n.popover }, /* @__PURE__ */ e.createElement(
35
- r.Menu,
36
- {
37
- className: n.contextMenu,
38
- onAction: s,
39
- selectionMode: f,
40
- selectedKeys: i,
41
- defaultSelectedKeys: c,
42
- disabledKeys: l,
43
- onSelectionChange: m,
44
- ref: p
45
- },
46
- /* @__PURE__ */ e.createElement(C, { props: x }, a)
47
- )));
48
- }), V = (o) => /* @__PURE__ */ e.createElement(v, null, /* @__PURE__ */ e.createElement(r.MenuTrigger, null, o.children));
49
- export {
50
- R as C,
51
- V as a
52
- };
@@ -1,20 +0,0 @@
1
- "use client"
2
- /* */
3
- import e from "react";
4
- import "mobx";
5
- import { u as n, a } from "./useOverlayController-CGKumeGL.js";
6
- import "./propsContext-DzAKlmhS.js";
7
- import { P as p } from "./PropsContextProvider-C6Z4XGp6.js";
8
- import "@react-aria/utils";
9
- import "remeda";
10
- const C = (o) => {
11
- const r = n(), t = {
12
- Button: {
13
- onPress: r.open
14
- }
15
- };
16
- return /* @__PURE__ */ e.createElement(a, { value: r }, /* @__PURE__ */ e.createElement(p, { props: t, mergeInParentContext: !0 }, o.children));
17
- };
18
- export {
19
- C as O
20
- };
@@ -1,41 +0,0 @@
1
- "use client"
2
- /* */
3
- import e, { forwardRef as u } from "react";
4
- import * as t from "react-aria-components";
5
- import O from "clsx";
6
- import "mobx";
7
- import { u as h, a as C } from "./useOverlayController-CGKumeGL.js";
8
- const x = "flow--popover", E = "flow--popover--content", P = "flow--popover--tip", r = {
9
- popover: x,
10
- content: E,
11
- tip: P,
12
- "popover-slide": "flow--popover--popover-slide"
13
- }, A = u((n, l) => {
14
- const {
15
- children: s,
16
- className: p,
17
- controller: a,
18
- withTip: c,
19
- defaultOpen: i = !1,
20
- ...m
21
- } = n, v = h({
22
- reuseControllerFromContext: !0,
23
- defaultOpen: i
24
- }), o = a ?? v, f = o.useIsOpen(), d = O(r.popover, p);
25
- return /* @__PURE__ */ e.createElement(
26
- t.Popover,
27
- {
28
- ...m,
29
- className: d,
30
- containerPadding: 16,
31
- ref: l,
32
- isOpen: f,
33
- onOpenChange: (w) => o.setOpen(w)
34
- },
35
- c && /* @__PURE__ */ e.createElement(t.OverlayArrow, { className: r.tip }, /* @__PURE__ */ e.createElement("svg", { width: 16, height: 16, viewBox: "0 0 16 16" }, /* @__PURE__ */ e.createElement("path", { d: "M0 0 L8 8 L16 0" }))),
36
- /* @__PURE__ */ e.createElement(t.Dialog, { className: r.content }, /* @__PURE__ */ e.createElement(C, { value: o }, s))
37
- );
38
- });
39
- export {
40
- A as P
41
- };
@@ -1,49 +0,0 @@
1
- "use client"
2
- /* */
3
- var p = Object.defineProperty;
4
- var a = (t, e, o) => e in t ? p(t, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[e] = o;
5
- var i = (t, e, o) => (a(t, typeof e != "symbol" ? e + "" : e, o), o);
6
- import { useRef as c, createContext as O, useContext as m } from "react";
7
- import { makeObservable as C, observable as b, action as s } from "mobx";
8
- import { u as d } from "./useSelector-DpU7_HMO.js";
9
- class n {
10
- constructor(e = !1) {
11
- i(this, "isOpen");
12
- C(this, {
13
- isOpen: b,
14
- open: s.bound,
15
- close: s.bound,
16
- toggle: s.bound,
17
- setOpen: s.bound
18
- }), this.isOpen = e;
19
- }
20
- static useNew(e) {
21
- return c(new n(e)).current;
22
- }
23
- open() {
24
- this.isOpen = !0;
25
- }
26
- close() {
27
- this.isOpen = !1;
28
- }
29
- toggle() {
30
- this.isOpen = !this.isOpen;
31
- }
32
- setOpen(e) {
33
- this.isOpen = e;
34
- }
35
- useIsOpen() {
36
- return d(() => this.isOpen);
37
- }
38
- }
39
- const l = O(
40
- void 0
41
- ), g = l.Provider, w = (t = {}) => {
42
- const { reuseControllerFromContext: e = !0, defaultOpen: o } = t, u = n.useNew(o), r = m(l);
43
- return e && r ? r : u;
44
- };
45
- export {
46
- n as O,
47
- g as a,
48
- w as u
49
- };