@mittwald/flow-react-components 0.2.0-alpha.676 → 0.2.0-alpha.677
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/CHANGELOG.md +10 -0
- package/dist/assets/doc-properties.json +2967 -2967
- package/dist/js/components/src/components/Action/MutedActionError.mjs +19 -0
- package/dist/js/components/src/components/Action/MutedActionError.mjs.map +1 -0
- package/dist/js/components/src/components/Action/models/ActionExecution.mjs +11 -1
- package/dist/js/components/src/components/Action/models/ActionExecution.mjs.map +1 -1
- package/dist/js/components/src/components/Action/models/ActionExecutionBatch.mjs +4 -1
- package/dist/js/components/src/components/Action/models/ActionExecutionBatch.mjs.map +1 -1
- package/dist/js/components/src/components/Button/Button.mjs +20 -8
- package/dist/js/components/src/components/Button/Button.mjs.map +1 -1
- package/dist/js/components/src/integrations/react-hook-form/components/Form/Form.mjs +4 -0
- package/dist/js/components/src/integrations/react-hook-form/components/Form/Form.mjs.map +1 -1
- package/dist/js/default.mjs +1 -0
- package/dist/js/default.mjs.map +1 -1
- package/dist/types/components/Action/MutedActionError.d.ts +6 -0
- package/dist/types/components/Action/MutedActionError.d.ts.map +1 -0
- package/dist/types/components/Action/index.d.ts +1 -0
- package/dist/types/components/Action/index.d.ts.map +1 -1
- package/dist/types/components/Action/models/ActionExecution.d.ts.map +1 -1
- package/dist/types/components/Action/models/ActionExecutionBatch.d.ts.map +1 -1
- package/dist/types/components/Button/Button.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Form/Form.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
/* */
|
|
3
|
+
class MutedActionError extends Error {
|
|
4
|
+
constructor(message) {
|
|
5
|
+
super(message);
|
|
6
|
+
this.name = "MutedActionError";
|
|
7
|
+
}
|
|
8
|
+
static isMutedActionError(error) {
|
|
9
|
+
return error instanceof MutedActionError;
|
|
10
|
+
}
|
|
11
|
+
static rethrowIfNotMuted(error) {
|
|
12
|
+
if (!MutedActionError.isMutedActionError(error)) {
|
|
13
|
+
throw error;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { MutedActionError };
|
|
19
|
+
//# sourceMappingURL=MutedActionError.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MutedActionError.mjs","sources":["../../../../../../src/components/Action/MutedActionError.ts"],"sourcesContent":["export class MutedActionError extends Error {\n public constructor(message?: string) {\n super(message);\n this.name = \"MutedActionError\";\n }\n\n public static isMutedActionError(error: unknown): error is MutedActionError {\n return error instanceof MutedActionError;\n }\n\n public static rethrowIfNotMuted(error: unknown): void {\n if (!MutedActionError.isMutedActionError(error)) {\n throw error;\n }\n }\n}\n"],"names":[],"mappings":"AAAO,MAAM,yBAAyB,KAAA,CAAM;AAAA,EACnC,YAAY,OAAA,EAAkB;AACnC,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,kBAAA;AAAA,EACd;AAAA,EAEA,OAAc,mBAAmB,KAAA,EAA2C;AAC1E,IAAA,OAAO,KAAA,YAAiB,gBAAA;AAAA,EAC1B;AAAA,EAEA,OAAc,kBAAkB,KAAA,EAAsB;AACpD,IAAA,IAAI,CAAC,gBAAA,CAAiB,kBAAA,CAAmB,KAAK,CAAA,EAAG;AAC/C,MAAA,MAAM,KAAA;AAAA,IACR;AAAA,EACF;AACF;;;;"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
/* */
|
|
3
3
|
import { ActionExecutionBatch } from './ActionExecutionBatch.mjs';
|
|
4
4
|
import { callFunctionsInOrder } from '../../../lib/promises/callFunctionsInOrder.mjs';
|
|
5
|
+
import { MutedActionError } from '../MutedActionError.mjs';
|
|
5
6
|
|
|
6
7
|
class ActionExecution {
|
|
7
8
|
action;
|
|
@@ -13,7 +14,16 @@ class ActionExecution {
|
|
|
13
14
|
const executeBatchedActions = callFunctionsInOrder(
|
|
14
15
|
batches.map((b) => b.executeBatch.bind(b))
|
|
15
16
|
);
|
|
16
|
-
|
|
17
|
+
try {
|
|
18
|
+
const maybePromise = executeBatchedActions(...args);
|
|
19
|
+
if (maybePromise instanceof Promise) {
|
|
20
|
+
maybePromise.catch((error) => {
|
|
21
|
+
MutedActionError.rethrowIfNotMuted(error);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
} catch (error) {
|
|
25
|
+
MutedActionError.rethrowIfNotMuted(error);
|
|
26
|
+
}
|
|
17
27
|
};
|
|
18
28
|
getBatchedActions = () => {
|
|
19
29
|
let currentAction = this.action;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionExecution.mjs","sources":["../../../../../../../src/components/Action/models/ActionExecution.tsx"],"sourcesContent":["import type { ActionModel } from \"@/components/Action/models/ActionModel\";\nimport { ActionExecutionBatch } from \"@/components/Action/models/ActionExecutionBatch\";\nimport { callFunctionsInOrder } from \"@/lib/promises/callFunctionsInOrder\";\n\nexport class ActionExecution {\n private readonly action: ActionModel;\n\n public constructor(action: ActionModel) {\n this.action = action;\n }\n\n public execute = (...args: unknown[]): void => {\n const batches = this.getBatchedActions();\n\n const executeBatchedActions = callFunctionsInOrder(\n batches.map((b) => b.executeBatch.bind(b)),\n );\n\n executeBatchedActions(...args);\n };\n\n private getBatchedActions = (): ActionExecutionBatch[] => {\n let currentAction: ActionModel | undefined = this.action;\n\n const batches: ActionExecutionBatch[] = [];\n let currentBatch: ActionExecutionBatch = new ActionExecutionBatch(\n this.action,\n );\n\n let skipCount = 0;\n\n while (currentAction) {\n const { onAction, break: $break, skip } = currentAction.actionProps;\n\n if (currentAction.needsConfirmation) {\n currentBatch.addAction(currentAction);\n break;\n }\n\n if (skip) {\n skipCount = skip === true ? 1 : skip;\n currentAction = currentAction.parentAction;\n continue;\n }\n\n if (skipCount > 0) {\n currentAction = currentAction.parentAction;\n skipCount--;\n continue;\n }\n\n if ($break) {\n break;\n }\n\n if (onAction) {\n currentBatch.addAction(currentAction);\n } else {\n batches.push(currentBatch);\n currentBatch = new ActionExecutionBatch(this.action);\n currentBatch.addAction(currentAction);\n }\n\n currentAction = currentAction.parentAction;\n }\n\n batches.push(currentBatch);\n return batches;\n };\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ActionExecution.mjs","sources":["../../../../../../../src/components/Action/models/ActionExecution.tsx"],"sourcesContent":["import type { ActionModel } from \"@/components/Action/models/ActionModel\";\nimport { ActionExecutionBatch } from \"@/components/Action/models/ActionExecutionBatch\";\nimport { callFunctionsInOrder } from \"@/lib/promises/callFunctionsInOrder\";\nimport { MutedActionError } from \"@/components/Action/MutedActionError\";\n\nexport class ActionExecution {\n private readonly action: ActionModel;\n\n public constructor(action: ActionModel) {\n this.action = action;\n }\n\n public execute = (...args: unknown[]): void => {\n const batches = this.getBatchedActions();\n\n const executeBatchedActions = callFunctionsInOrder(\n batches.map((b) => b.executeBatch.bind(b)),\n );\n\n try {\n const maybePromise = executeBatchedActions(...args);\n if (maybePromise instanceof Promise) {\n maybePromise.catch((error) => {\n MutedActionError.rethrowIfNotMuted(error);\n });\n }\n } catch (error) {\n MutedActionError.rethrowIfNotMuted(error);\n }\n };\n\n private getBatchedActions = (): ActionExecutionBatch[] => {\n let currentAction: ActionModel | undefined = this.action;\n\n const batches: ActionExecutionBatch[] = [];\n let currentBatch: ActionExecutionBatch = new ActionExecutionBatch(\n this.action,\n );\n\n let skipCount = 0;\n\n while (currentAction) {\n const { onAction, break: $break, skip } = currentAction.actionProps;\n\n if (currentAction.needsConfirmation) {\n currentBatch.addAction(currentAction);\n break;\n }\n\n if (skip) {\n skipCount = skip === true ? 1 : skip;\n currentAction = currentAction.parentAction;\n continue;\n }\n\n if (skipCount > 0) {\n currentAction = currentAction.parentAction;\n skipCount--;\n continue;\n }\n\n if ($break) {\n break;\n }\n\n if (onAction) {\n currentBatch.addAction(currentAction);\n } else {\n batches.push(currentBatch);\n currentBatch = new ActionExecutionBatch(this.action);\n currentBatch.addAction(currentAction);\n }\n\n currentAction = currentAction.parentAction;\n }\n\n batches.push(currentBatch);\n return batches;\n };\n}\n"],"names":[],"mappings":";;;;AAKO,MAAM,eAAA,CAAgB;AAAA,EACV,MAAA;AAAA,EAEV,YAAY,MAAA,EAAqB;AACtC,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AAAA,EAChB;AAAA,EAEO,OAAA,GAAU,IAAI,IAAA,KAA0B;AAC7C,IAAA,MAAM,OAAA,GAAU,KAAK,iBAAA,EAAkB;AAEvC,IAAA,MAAM,qBAAA,GAAwB,oBAAA;AAAA,MAC5B,OAAA,CAAQ,IAAI,CAAC,CAAA,KAAM,EAAE,YAAA,CAAa,IAAA,CAAK,CAAC,CAAC;AAAA,KAC3C;AAEA,IAAA,IAAI;AACF,MAAA,MAAM,YAAA,GAAe,qBAAA,CAAsB,GAAG,IAAI,CAAA;AAClD,MAAA,IAAI,wBAAwB,OAAA,EAAS;AACnC,QAAA,YAAA,CAAa,KAAA,CAAM,CAAC,KAAA,KAAU;AAC5B,UAAA,gBAAA,CAAiB,kBAAkB,KAAK,CAAA;AAAA,QAC1C,CAAC,CAAA;AAAA,MACH;AAAA,IACF,SAAS,KAAA,EAAO;AACd,MAAA,gBAAA,CAAiB,kBAAkB,KAAK,CAAA;AAAA,IAC1C;AAAA,EACF,CAAA;AAAA,EAEQ,oBAAoB,MAA8B;AACxD,IAAA,IAAI,gBAAyC,IAAA,CAAK,MAAA;AAElD,IAAA,MAAM,UAAkC,EAAC;AACzC,IAAA,IAAI,eAAqC,IAAI,oBAAA;AAAA,MAC3C,IAAA,CAAK;AAAA,KACP;AAEA,IAAA,IAAI,SAAA,GAAY,CAAA;AAEhB,IAAA,OAAO,aAAA,EAAe;AACpB,MAAA,MAAM,EAAE,QAAA,EAAU,KAAA,EAAO,MAAA,EAAQ,IAAA,KAAS,aAAA,CAAc,WAAA;AAExD,MAAA,IAAI,cAAc,iBAAA,EAAmB;AACnC,QAAA,YAAA,CAAa,UAAU,aAAa,CAAA;AACpC,QAAA;AAAA,MACF;AAEA,MAAA,IAAI,IAAA,EAAM;AACR,QAAA,SAAA,GAAY,IAAA,KAAS,OAAO,CAAA,GAAI,IAAA;AAChC,QAAA,aAAA,GAAgB,aAAA,CAAc,YAAA;AAC9B,QAAA;AAAA,MACF;AAEA,MAAA,IAAI,YAAY,CAAA,EAAG;AACjB,QAAA,aAAA,GAAgB,aAAA,CAAc,YAAA;AAC9B,QAAA,SAAA,EAAA;AACA,QAAA;AAAA,MACF;AAEA,MAAA,IAAI,MAAA,EAAQ;AACV,QAAA;AAAA,MACF;AAEA,MAAA,IAAI,QAAA,EAAU;AACZ,QAAA,YAAA,CAAa,UAAU,aAAa,CAAA;AAAA,MACtC,CAAA,MAAO;AACL,QAAA,OAAA,CAAQ,KAAK,YAAY,CAAA;AACzB,QAAA,YAAA,GAAe,IAAI,oBAAA,CAAqB,IAAA,CAAK,MAAM,CAAA;AACnD,QAAA,YAAA,CAAa,UAAU,aAAa,CAAA;AAAA,MACtC;AAEA,MAAA,aAAA,GAAgB,aAAA,CAAc,YAAA;AAAA,IAChC;AAEA,IAAA,OAAA,CAAQ,KAAK,YAAY,CAAA;AACzB,IAAA,OAAO,OAAA;AAAA,EACT,CAAA;AACF;;;;"}
|
|
@@ -35,7 +35,10 @@ class ActionExecutionBatch {
|
|
|
35
35
|
executionState.onAsyncStart();
|
|
36
36
|
return result.then(onSucceeded).catch(onError);
|
|
37
37
|
} else {
|
|
38
|
-
onSucceeded();
|
|
38
|
+
const onSucceededResult = onSucceeded();
|
|
39
|
+
if (onSucceededResult instanceof Promise) {
|
|
40
|
+
return onSucceededResult.then(() => result);
|
|
41
|
+
}
|
|
39
42
|
return result;
|
|
40
43
|
}
|
|
41
44
|
} catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionExecutionBatch.mjs","sources":["../../../../../../../src/components/Action/models/ActionExecutionBatch.ts"],"sourcesContent":["import type { ActionModel } from \"@/components/Action/models/ActionModel\";\nimport { callFunctionsInOrder } from \"@/lib/promises/callFunctionsInOrder\";\nimport { getExecutionFunction } from \"@/components/Action/models/getExecutionFunction\";\n\nexport class ActionExecutionBatch {\n private readonly actions: ActionModel[] = [];\n public readonly baseAction: ActionModel;\n\n constructor(baseAction: ActionModel) {\n this.baseAction = baseAction;\n }\n\n public addAction(action: ActionModel): void {\n this.actions.push(action);\n }\n\n public executeBatch(...args: unknown[]) {\n if (this.actions.length === 0) {\n return;\n }\n\n const batchFeedback =\n this.actions[this.actions.length - 1]?.actionProps.showFeedback;\n\n const executionState = this.baseAction.state.withFeedback(\n this.baseAction.needsConfirmation ? false : batchFeedback,\n );\n\n const executionFunctions = this.actions.map((c) => getExecutionFunction(c));\n\n const executeBatch = callFunctionsInOrder(executionFunctions);\n\n const onError = (error: unknown): void => {\n executionState.onFailed(error);\n throw error;\n };\n\n const onSucceeded = () => {\n return executionState.onSucceeded();\n };\n\n try {\n const result = executeBatch(...args);\n if (result instanceof Promise) {\n executionState.onAsyncStart();\n return result.then(onSucceeded).catch(onError);\n } else {\n onSucceeded();\n return result;\n }\n } catch (error) {\n onError(error);\n }\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,oBAAA,CAAqB;AAAA,EACf,UAAyB,EAAC;AAAA,EAC3B,UAAA;AAAA,EAEhB,YAAY,UAAA,EAAyB;AACnC,IAAA,IAAA,CAAK,UAAA,GAAa,UAAA;AAAA,EACpB;AAAA,EAEO,UAAU,MAAA,EAA2B;AAC1C,IAAA,IAAA,CAAK,OAAA,CAAQ,KAAK,MAAM,CAAA;AAAA,EAC1B;AAAA,EAEO,gBAAgB,IAAA,EAAiB;AACtC,IAAA,IAAI,IAAA,CAAK,OAAA,CAAQ,MAAA,KAAW,CAAA,EAAG;AAC7B,MAAA;AAAA,IACF;AAEA,IAAA,MAAM,aAAA,GACJ,KAAK,OAAA,CAAQ,IAAA,CAAK,QAAQ,MAAA,GAAS,CAAC,GAAG,WAAA,CAAY,YAAA;AAErD,IAAA,MAAM,cAAA,GAAiB,IAAA,CAAK,UAAA,CAAW,KAAA,CAAM,YAAA;AAAA,MAC3C,IAAA,CAAK,UAAA,CAAW,iBAAA,GAAoB,KAAA,GAAQ;AAAA,KAC9C;AAEA,IAAA,MAAM,kBAAA,GAAqB,KAAK,OAAA,CAAQ,GAAA,CAAI,CAAC,CAAA,KAAM,oBAAA,CAAqB,CAAC,CAAC,CAAA;AAE1E,IAAA,MAAM,YAAA,GAAe,qBAAqB,kBAAkB,CAAA;AAE5D,IAAA,MAAM,OAAA,GAAU,CAAC,KAAA,KAAyB;AACxC,MAAA,cAAA,CAAe,SAAS,KAAK,CAAA;AAC7B,MAAA,MAAM,KAAA;AAAA,IACR,CAAA;AAEA,IAAA,MAAM,cAAc,MAAM;AACxB,MAAA,OAAO,eAAe,WAAA,EAAY;AAAA,IACpC,CAAA;AAEA,IAAA,IAAI;AACF,MAAA,MAAM,MAAA,GAAS,YAAA,CAAa,GAAG,IAAI,CAAA;AACnC,MAAA,IAAI,kBAAkB,OAAA,EAAS;AAC7B,QAAA,cAAA,CAAe,YAAA,EAAa;AAC5B,QAAA,OAAO,MAAA,CAAO,IAAA,CAAK,WAAW,CAAA,CAAE,MAAM,OAAO,CAAA;AAAA,MAC/C,CAAA,MAAO;AACL,QAAA,WAAA,EAAY;
|
|
1
|
+
{"version":3,"file":"ActionExecutionBatch.mjs","sources":["../../../../../../../src/components/Action/models/ActionExecutionBatch.ts"],"sourcesContent":["import type { ActionModel } from \"@/components/Action/models/ActionModel\";\nimport { callFunctionsInOrder } from \"@/lib/promises/callFunctionsInOrder\";\nimport { getExecutionFunction } from \"@/components/Action/models/getExecutionFunction\";\n\nexport class ActionExecutionBatch {\n private readonly actions: ActionModel[] = [];\n public readonly baseAction: ActionModel;\n\n constructor(baseAction: ActionModel) {\n this.baseAction = baseAction;\n }\n\n public addAction(action: ActionModel): void {\n this.actions.push(action);\n }\n\n public executeBatch(...args: unknown[]) {\n if (this.actions.length === 0) {\n return;\n }\n\n const batchFeedback =\n this.actions[this.actions.length - 1]?.actionProps.showFeedback;\n\n const executionState = this.baseAction.state.withFeedback(\n this.baseAction.needsConfirmation ? false : batchFeedback,\n );\n\n const executionFunctions = this.actions.map((c) => getExecutionFunction(c));\n\n const executeBatch = callFunctionsInOrder(executionFunctions);\n\n const onError = (error: unknown): void => {\n executionState.onFailed(error);\n throw error;\n };\n\n const onSucceeded = () => {\n return executionState.onSucceeded();\n };\n\n try {\n const result = executeBatch(...args);\n if (result instanceof Promise) {\n executionState.onAsyncStart();\n return result.then(onSucceeded).catch(onError);\n } else {\n const onSucceededResult = onSucceeded();\n if (onSucceededResult instanceof Promise) {\n return onSucceededResult.then(() => result);\n }\n return result;\n }\n } catch (error) {\n onError(error);\n }\n }\n}\n"],"names":[],"mappings":";;;AAIO,MAAM,oBAAA,CAAqB;AAAA,EACf,UAAyB,EAAC;AAAA,EAC3B,UAAA;AAAA,EAEhB,YAAY,UAAA,EAAyB;AACnC,IAAA,IAAA,CAAK,UAAA,GAAa,UAAA;AAAA,EACpB;AAAA,EAEO,UAAU,MAAA,EAA2B;AAC1C,IAAA,IAAA,CAAK,OAAA,CAAQ,KAAK,MAAM,CAAA;AAAA,EAC1B;AAAA,EAEO,gBAAgB,IAAA,EAAiB;AACtC,IAAA,IAAI,IAAA,CAAK,OAAA,CAAQ,MAAA,KAAW,CAAA,EAAG;AAC7B,MAAA;AAAA,IACF;AAEA,IAAA,MAAM,aAAA,GACJ,KAAK,OAAA,CAAQ,IAAA,CAAK,QAAQ,MAAA,GAAS,CAAC,GAAG,WAAA,CAAY,YAAA;AAErD,IAAA,MAAM,cAAA,GAAiB,IAAA,CAAK,UAAA,CAAW,KAAA,CAAM,YAAA;AAAA,MAC3C,IAAA,CAAK,UAAA,CAAW,iBAAA,GAAoB,KAAA,GAAQ;AAAA,KAC9C;AAEA,IAAA,MAAM,kBAAA,GAAqB,KAAK,OAAA,CAAQ,GAAA,CAAI,CAAC,CAAA,KAAM,oBAAA,CAAqB,CAAC,CAAC,CAAA;AAE1E,IAAA,MAAM,YAAA,GAAe,qBAAqB,kBAAkB,CAAA;AAE5D,IAAA,MAAM,OAAA,GAAU,CAAC,KAAA,KAAyB;AACxC,MAAA,cAAA,CAAe,SAAS,KAAK,CAAA;AAC7B,MAAA,MAAM,KAAA;AAAA,IACR,CAAA;AAEA,IAAA,MAAM,cAAc,MAAM;AACxB,MAAA,OAAO,eAAe,WAAA,EAAY;AAAA,IACpC,CAAA;AAEA,IAAA,IAAI;AACF,MAAA,MAAM,MAAA,GAAS,YAAA,CAAa,GAAG,IAAI,CAAA;AACnC,MAAA,IAAI,kBAAkB,OAAA,EAAS;AAC7B,QAAA,cAAA,CAAe,YAAA,EAAa;AAC5B,QAAA,OAAO,MAAA,CAAO,IAAA,CAAK,WAAW,CAAA,CAAE,MAAM,OAAO,CAAA;AAAA,MAC/C,CAAA,MAAO;AACL,QAAA,MAAM,oBAAoB,WAAA,EAAY;AACtC,QAAA,IAAI,6BAA6B,OAAA,EAAS;AACxC,UAAA,OAAO,iBAAA,CAAkB,IAAA,CAAK,MAAM,MAAM,CAAA;AAAA,QAC5C;AACA,QAAA,OAAO,MAAA;AAAA,MACT;AAAA,IACF,SAAS,KAAA,EAAO;AACd,MAAA,OAAA,CAAQ,KAAK,CAAA;AAAA,IACf;AAAA,EACF;AACF;;;;"}
|
|
@@ -22,14 +22,26 @@ import { extractTextFromFirstChild } from '../../lib/react/remote.mjs';
|
|
|
22
22
|
const disablePendingProps = (props) => {
|
|
23
23
|
if (props.isPending || props.isSucceeded || props.isFailed || props["aria-disabled"] || props.isReadOnly) {
|
|
24
24
|
props = { ...props };
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
const mutedActionHandler = (e) => {
|
|
26
|
+
if (e && typeof e === "object") {
|
|
27
|
+
const isReactAriaEvent = "continuePropagation" in e && typeof e.continuePropagation === "function";
|
|
28
|
+
if (!isReactAriaEvent && "stopPropagation" in e && typeof e.stopPropagation === "function") {
|
|
29
|
+
e.stopPropagation();
|
|
30
|
+
}
|
|
31
|
+
if ("preventDefault" in e && typeof e.preventDefault === "function") {
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
};
|
|
37
|
+
props.onClick = mutedActionHandler;
|
|
38
|
+
props.onPress = mutedActionHandler;
|
|
39
|
+
props.onPressStart = mutedActionHandler;
|
|
40
|
+
props.onPressEnd = mutedActionHandler;
|
|
41
|
+
props.onPressChange = mutedActionHandler;
|
|
42
|
+
props.onPressUp = mutedActionHandler;
|
|
43
|
+
props.onKeyDown = mutedActionHandler;
|
|
44
|
+
props.onKeyUp = mutedActionHandler;
|
|
33
45
|
}
|
|
34
46
|
return props;
|
|
35
47
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.mjs","sources":["../../../../../../src/components/Button/Button.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport styles from \"./Button.module.scss\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { IconFailed, IconSucceeded } from \"@/components/Icon/components/icons\";\nimport { Wrap } from \"@/components/Wrap\";\nimport { Text } from \"@/components/Text\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport LoadingSpinner from \"@/components/LoadingSpinner/LoadingSpinner\";\nimport { useAriaAnnounceActionState } from \"@/components/Action/lib/ariaLive\";\nimport { extractTextFromFirstChild } from \"@/lib/react/remote\";\n\nexport interface ButtonProps\n extends\n PropsWithChildren<Aria.ButtonProps>,\n FlowComponentProps<HTMLButtonElement> {\n /** Slot for button placement in action groups. */\n slot?: string;\n /** The color of the button. @default \"primary\" */\n color?: \"primary\" | \"accent\" | \"secondary\" | \"danger\" | \"dark\" | \"light\";\n /** The visual variant of the button. @default \"solid\" */\n variant?: \"plain\" | \"solid\" | \"soft\" | \"outline\";\n /** The size of the button. @default \"m\" */\n size?: \"m\" | \"s\";\n /** Disables button but keeps it focusable. */\n \"aria-disabled\"?: boolean;\n /** Whether the button is in a pending state. */\n isPending?: boolean;\n /** Whether the button is in a succeeded state. */\n isSucceeded?: boolean;\n /** Whether the button is in a failed state. */\n isFailed?: boolean;\n /** Whether the button is in a read only state. */\n isReadOnly?: boolean;\n /** @internal */\n unstyled?: boolean;\n /** @internal */\n ariaSlot?: string | null;\n}\n\nconst disablePendingProps = (props: ButtonProps) => {\n if (\n props.isPending ||\n props.isSucceeded ||\n props.isFailed ||\n props[\"aria-disabled\"] ||\n props.isReadOnly\n ) {\n props = { ...props };\n props.
|
|
1
|
+
{"version":3,"file":"Button.mjs","sources":["../../../../../../src/components/Button/Button.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport styles from \"./Button.module.scss\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { IconFailed, IconSucceeded } from \"@/components/Icon/components/icons\";\nimport { Wrap } from \"@/components/Wrap\";\nimport { Text } from \"@/components/Text\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport LoadingSpinner from \"@/components/LoadingSpinner/LoadingSpinner\";\nimport { useAriaAnnounceActionState } from \"@/components/Action/lib/ariaLive\";\nimport { extractTextFromFirstChild } from \"@/lib/react/remote\";\n\nexport interface ButtonProps\n extends\n PropsWithChildren<Aria.ButtonProps>,\n FlowComponentProps<HTMLButtonElement> {\n /** Slot for button placement in action groups. */\n slot?: string;\n /** The color of the button. @default \"primary\" */\n color?: \"primary\" | \"accent\" | \"secondary\" | \"danger\" | \"dark\" | \"light\";\n /** The visual variant of the button. @default \"solid\" */\n variant?: \"plain\" | \"solid\" | \"soft\" | \"outline\";\n /** The size of the button. @default \"m\" */\n size?: \"m\" | \"s\";\n /** Disables button but keeps it focusable. */\n \"aria-disabled\"?: boolean;\n /** Whether the button is in a pending state. */\n isPending?: boolean;\n /** Whether the button is in a succeeded state. */\n isSucceeded?: boolean;\n /** Whether the button is in a failed state. */\n isFailed?: boolean;\n /** Whether the button is in a read only state. */\n isReadOnly?: boolean;\n /** @internal */\n unstyled?: boolean;\n /** @internal */\n ariaSlot?: string | null;\n}\n\nconst disablePendingProps = (props: ButtonProps) => {\n if (\n props.isPending ||\n props.isSucceeded ||\n props.isFailed ||\n props[\"aria-disabled\"] ||\n props.isReadOnly\n ) {\n props = { ...props };\n\n const mutedActionHandler = (e: unknown) => {\n if (e && typeof e === \"object\") {\n // stopPropagation is the default behavior in React Aria\n const isReactAriaEvent =\n \"continuePropagation\" in e &&\n typeof e.continuePropagation === \"function\";\n\n if (\n !isReactAriaEvent &&\n \"stopPropagation\" in e &&\n typeof e.stopPropagation === \"function\"\n ) {\n e.stopPropagation();\n }\n if (\"preventDefault\" in e && typeof e.preventDefault === \"function\") {\n e.preventDefault();\n }\n }\n\n return false;\n };\n\n props.onClick = mutedActionHandler;\n props.onPress = mutedActionHandler;\n props.onPressStart = mutedActionHandler;\n props.onPressEnd = mutedActionHandler;\n props.onPressChange = mutedActionHandler;\n props.onPressUp = mutedActionHandler;\n props.onKeyDown = mutedActionHandler;\n props.onKeyUp = mutedActionHandler;\n }\n\n return props;\n};\n\n/** @flr-generate all */\nexport const Button = flowComponent(\"Button\", (props) => {\n props = disablePendingProps(props);\n\n const {\n color = \"primary\",\n variant = \"solid\",\n children,\n className,\n size = \"m\",\n isPending,\n isSucceeded,\n isFailed,\n \"aria-disabled\": ariaDisabled,\n ref,\n slot: ignoredSlotProp,\n ariaSlot: slot,\n unstyled,\n isReadOnly,\n ...restProps\n } = props;\n\n const rootClassName = unstyled\n ? className\n : clsx(\n styles.button,\n isPending && styles.isPending,\n isSucceeded && styles.isSucceeded,\n isFailed && styles.isFailed,\n styles[`size-${size}`],\n styles[color],\n styles[variant],\n className,\n /**\n * Workaround warning: The Aria.Button does not support \"aria-disabled\"\n * by now, so this Button will be visually disabled via CSS.\n */\n ariaDisabled && styles.ariaDisabled,\n );\n\n useAriaAnnounceActionState(\n isPending\n ? \"isPending\"\n : isSucceeded\n ? \"isSucceeded\"\n : isFailed\n ? \"isFailed\"\n : \"isIdle\",\n );\n\n const propsContext: PropsContext = {\n Icon: {\n className: styles.icon,\n \"aria-hidden\": true,\n size,\n },\n Text: {\n className: styles.text,\n },\n Avatar: {\n className: styles.avatar,\n },\n CounterBadge: {\n className: styles.counterBadge,\n },\n Image: {\n className: styles.image,\n },\n };\n\n const StateIconComponent = isSucceeded\n ? IconSucceeded\n : isFailed\n ? IconFailed\n : isPending\n ? LoadingSpinner\n : undefined;\n\n const stateIcon = StateIconComponent && (\n <StateIconComponent\n size={size}\n className={styles.stateIcon}\n status={isFailed ? \"danger\" : isSucceeded ? \"success\" : undefined}\n />\n );\n\n const isStringContent = extractTextFromFirstChild(children) !== undefined;\n\n return (\n <Aria.Button\n className={rootClassName}\n ref={ref}\n slot={slot}\n {...(isReadOnly === true ? { \"data-readonly\": true } : {})}\n {...restProps}\n >\n <PropsContextProvider props={propsContext}>\n <Wrap if={!unstyled}>\n <span className={styles.content}>\n <Wrap if={isStringContent}>\n <Text className={styles.text}>{children}</Text>\n </Wrap>\n </span>\n </Wrap>\n </PropsContextProvider>\n {stateIcon}\n </Aria.Button>\n );\n});\n\nexport default Button;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AA2CA,MAAM,mBAAA,GAAsB,CAAC,KAAA,KAAuB;AAClD,EAAA,IACE,KAAA,CAAM,SAAA,IACN,KAAA,CAAM,WAAA,IACN,KAAA,CAAM,YACN,KAAA,CAAM,eAA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,UAAA,GACA,YACE,cAAA,GACA,MAAA;AAER,EAAA,MAAM,YAAY,kBAAA,oBAChB,GAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MACC,IAAA;AAAA,MACA,WAAW,MAAA,CAAO,SAAA;AAAA,MAClB,MAAA,EAAQ,QAAA,GAAW,QAAA,GAAW,WAAA,GAAc,SAAA,GAAY;AAAA;AAAA,GAC1D;AAGF,EAAA,MAAM,eAAA,GAAkB,yBAAA,CAA0B,QAAQ,CAAA,KAAM,MAAA;AAEhE,EAAA,uBACE,IAAA;AAAA,IAAC,IAAA,CAAK,MAAA;AAAA,IAAL;AAAA,MACC,SAAA,EAAW,aAAA;AAAA,MACX,GAAA;AAAA,MACA,IAAA;AAAA,MACC,GAAI,UAAA,KAAe,IAAA,GAAO,EAAE,eAAA,EAAiB,IAAA,KAAS,EAAC;AAAA,MACvD,GAAG,SAAA;AAAA,MAEJ,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,oBAAA,EAAA,EAAqB,KAAA,EAAO,YAAA,EAC3B,QAAA,kBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,EAAA,EAAI,CAAC,QAAA,EACT,QAAA,kBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAW,MAAA,CAAO,OAAA,EACtB,8BAAC,IAAA,EAAA,EAAK,EAAA,EAAI,eAAA,EACR,QAAA,kBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,SAAA,EAAW,MAAA,CAAO,IAAA,EAAO,QAAA,EAAS,CAAA,EAC1C,CAAA,EACF,CAAA,EACF,CAAA,EACF,CAAA;AAAA,QACC;AAAA;AAAA;AAAA,GACH;AAEJ,CAAC;;;;"}
|
|
@@ -22,6 +22,7 @@ function Form(props) {
|
|
|
22
22
|
const formId = idProp ?? newFormId;
|
|
23
23
|
const FormComponent = useMemo(() => formComponent, [formId]);
|
|
24
24
|
const afterSubmitCallback = useRef(void 0);
|
|
25
|
+
const { isSubmitting, isValidating } = form.formState;
|
|
25
26
|
const handleSubmitResult = (result) => {
|
|
26
27
|
if (typeof result === "function") {
|
|
27
28
|
afterSubmitCallback.current = result;
|
|
@@ -30,6 +31,9 @@ function Form(props) {
|
|
|
30
31
|
const handleSubmit = (e) => {
|
|
31
32
|
const formEvent = e && "nativeEvent" in e ? e : void 0;
|
|
32
33
|
formEvent?.stopPropagation();
|
|
34
|
+
if (isSubmitting || isValidating) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
33
37
|
return form.handleSubmit((values, event) => {
|
|
34
38
|
const submitResult = onSubmit(values, event);
|
|
35
39
|
if (submitResult instanceof Promise) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/Form/Form.tsx"],"sourcesContent":["import { useHotkeySubmit } from \"@/integrations/react-hook-form/components/Form/useHotkeySubmit\";\nimport { FormContextProvider } from \"@/integrations/react-hook-form/components/FormContextProvider/FormContextProvider\";\nimport {\n type ComponentProps,\n type FC,\n type FormEvent,\n type FormEventHandler,\n type PropsWithChildren,\n type Ref,\n useId,\n useMemo,\n useRef,\n} from \"react\";\nimport type {\n FieldValues,\n SubmitHandler,\n UseFormReturn,\n} from \"react-hook-form\";\nimport { FormProvider as RhfFormContextProvider } from \"react-hook-form\";\n\nexport type FormOnSubmitHandler<F extends FieldValues> = SubmitHandler<F>;\n\nexport type AfterFormSubmitCallback = (...unknownArgs: unknown[]) => unknown;\n\ntype FormComponentType = FC<\n PropsWithChildren<{\n id: string;\n onSubmit?: FormEventHandler | FormOnSubmitHandler<never>;\n ref?: Ref<HTMLFormElement>;\n }>\n>;\n\nexport interface FormProps<F extends FieldValues>\n extends Omit<ComponentProps<\"form\">, \"onSubmit\">, PropsWithChildren {\n form: UseFormReturn<F>;\n onSubmit: FormOnSubmitHandler<F>;\n formComponent?: FC<Omit<FormComponentType, \"ref\">>;\n isReadOnly?: boolean;\n}\n\nconst DefaultFormComponent: FormComponentType = (p) => <form {...p} />;\n\nexport function Form<F extends FieldValues>(props: FormProps<F>) {\n const {\n form,\n children,\n onSubmit,\n formComponent = DefaultFormComponent,\n isReadOnly,\n ref,\n id: idProp,\n ...formProps\n } = props;\n\n const newFormId = useId();\n const formId = idProp ?? newFormId;\n const FormComponent = useMemo(() => formComponent, [formId]);\n const afterSubmitCallback = useRef<AfterFormSubmitCallback>(undefined);\n\n const handleSubmitResult = (result: unknown) => {\n if (typeof result === \"function\") {\n afterSubmitCallback.current = result as AfterFormSubmitCallback;\n }\n };\n\n const handleSubmit = (e?: FormEvent | F) => {\n const formEvent = e && \"nativeEvent\" in e ? (e as FormEvent) : undefined;\n formEvent?.stopPropagation();\n return form.handleSubmit((values, event) => {\n const submitResult = onSubmit(values, event);\n if (submitResult instanceof Promise) {\n return submitResult.then(handleSubmitResult);\n }\n handleSubmitResult(submitResult);\n })(formEvent);\n };\n\n const onAfterSuccessFeedback = () => {\n afterSubmitCallback.current?.();\n };\n\n const refWithHotkeySubmit = useHotkeySubmit({\n ref,\n handleSubmit,\n });\n\n return (\n <RhfFormContextProvider {...form}>\n <FormContextProvider\n form={form as UseFormReturn}\n isReadOnly={isReadOnly}\n id={formId}\n onAfterSuccessFeedback={onAfterSuccessFeedback}\n >\n <FormComponent\n {...formProps}\n ref={refWithHotkeySubmit}\n id={formId}\n onSubmit={handleSubmit}\n >\n {children}\n </FormComponent>\n </FormContextProvider>\n </RhfFormContextProvider>\n );\n}\n\nexport default Form;\n"],"names":["RhfFormContextProvider"],"mappings":";;;;;;AAwCA,MAAM,uBAA0C,CAAC,CAAA,qBAAM,GAAA,CAAC,MAAA,EAAA,EAAM,GAAG,CAAA,EAAG,CAAA;AAE7D,SAAS,KAA4B,KAAA,EAAqB;AAC/D,EAAA,MAAM;AAAA,IACJ,IAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,aAAA,GAAgB,oBAAA;AAAA,IAChB,UAAA;AAAA,IACA,GAAA;AAAA,IACA,EAAA,EAAI,MAAA;AAAA,IACJ,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM,YAAY,KAAA,EAAM;AACxB,EAAA,MAAM,SAAS,MAAA,IAAU,SAAA;AACzB,EAAA,MAAM,gBAAgB,OAAA,CAAQ,MAAM,aAAA,EAAe,CAAC,MAAM,CAAC,CAAA;AAC3D,EAAA,MAAM,mBAAA,GAAsB,OAAgC,MAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"Form.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/Form/Form.tsx"],"sourcesContent":["import { useHotkeySubmit } from \"@/integrations/react-hook-form/components/Form/useHotkeySubmit\";\nimport { FormContextProvider } from \"@/integrations/react-hook-form/components/FormContextProvider/FormContextProvider\";\nimport {\n type ComponentProps,\n type FC,\n type FormEvent,\n type FormEventHandler,\n type PropsWithChildren,\n type Ref,\n useId,\n useMemo,\n useRef,\n} from \"react\";\nimport type {\n FieldValues,\n SubmitHandler,\n UseFormReturn,\n} from \"react-hook-form\";\nimport { FormProvider as RhfFormContextProvider } from \"react-hook-form\";\n\nexport type FormOnSubmitHandler<F extends FieldValues> = SubmitHandler<F>;\n\nexport type AfterFormSubmitCallback = (...unknownArgs: unknown[]) => unknown;\n\ntype FormComponentType = FC<\n PropsWithChildren<{\n id: string;\n onSubmit?: FormEventHandler | FormOnSubmitHandler<never>;\n ref?: Ref<HTMLFormElement>;\n }>\n>;\n\nexport interface FormProps<F extends FieldValues>\n extends Omit<ComponentProps<\"form\">, \"onSubmit\">, PropsWithChildren {\n form: UseFormReturn<F>;\n onSubmit: FormOnSubmitHandler<F>;\n formComponent?: FC<Omit<FormComponentType, \"ref\">>;\n isReadOnly?: boolean;\n}\n\nconst DefaultFormComponent: FormComponentType = (p) => <form {...p} />;\n\nexport function Form<F extends FieldValues>(props: FormProps<F>) {\n const {\n form,\n children,\n onSubmit,\n formComponent = DefaultFormComponent,\n isReadOnly,\n ref,\n id: idProp,\n ...formProps\n } = props;\n\n const newFormId = useId();\n const formId = idProp ?? newFormId;\n const FormComponent = useMemo(() => formComponent, [formId]);\n const afterSubmitCallback = useRef<AfterFormSubmitCallback>(undefined);\n const { isSubmitting, isValidating } = form.formState;\n\n const handleSubmitResult = (result: unknown) => {\n if (typeof result === \"function\") {\n afterSubmitCallback.current = result as AfterFormSubmitCallback;\n }\n };\n\n const handleSubmit = (e?: FormEvent | F) => {\n const formEvent = e && \"nativeEvent\" in e ? (e as FormEvent) : undefined;\n formEvent?.stopPropagation();\n if (isSubmitting || isValidating) {\n return;\n }\n return form.handleSubmit((values, event) => {\n const submitResult = onSubmit(values, event);\n if (submitResult instanceof Promise) {\n return submitResult.then(handleSubmitResult);\n }\n handleSubmitResult(submitResult);\n })(formEvent);\n };\n\n const onAfterSuccessFeedback = () => {\n afterSubmitCallback.current?.();\n };\n\n const refWithHotkeySubmit = useHotkeySubmit({\n ref,\n handleSubmit,\n });\n\n return (\n <RhfFormContextProvider {...form}>\n <FormContextProvider\n form={form as UseFormReturn}\n isReadOnly={isReadOnly}\n id={formId}\n onAfterSuccessFeedback={onAfterSuccessFeedback}\n >\n <FormComponent\n {...formProps}\n ref={refWithHotkeySubmit}\n id={formId}\n onSubmit={handleSubmit}\n >\n {children}\n </FormComponent>\n </FormContextProvider>\n </RhfFormContextProvider>\n );\n}\n\nexport default Form;\n"],"names":["RhfFormContextProvider"],"mappings":";;;;;;AAwCA,MAAM,uBAA0C,CAAC,CAAA,qBAAM,GAAA,CAAC,MAAA,EAAA,EAAM,GAAG,CAAA,EAAG,CAAA;AAE7D,SAAS,KAA4B,KAAA,EAAqB;AAC/D,EAAA,MAAM;AAAA,IACJ,IAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,aAAA,GAAgB,oBAAA;AAAA,IAChB,UAAA;AAAA,IACA,GAAA;AAAA,IACA,EAAA,EAAI,MAAA;AAAA,IACJ,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM,YAAY,KAAA,EAAM;AACxB,EA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kBAAA,GAAA;AAAA,IAAC,mBAAA;AAAA,IAAA;AAAA,MACC,IAAA;AAAA,MACA,UAAA;AAAA,MACA,EAAA,EAAI,MAAA;AAAA,MACJ,sBAAA;AAAA,MAEA,QAAA,kBAAA,GAAA;AAAA,QAAC,aAAA;AAAA,QAAA;AAAA,UACE,GAAG,SAAA;AAAA,UACJ,GAAA,EAAK,mBAAA;AAAA,UACL,EAAA,EAAI,MAAA;AAAA,UACJ,QAAA,EAAU,YAAA;AAAA,UAET;AAAA;AAAA;AACH;AAAA,GACF,EACF,CAAA;AAEJ;;;;"}
|
package/dist/js/default.mjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
export { AccentBox } from './components/src/components/AccentBox/AccentBox.mjs';
|
|
4
4
|
export { Accordion } from './components/src/components/Accordion/Accordion.mjs';
|
|
5
5
|
export { Action } from './components/src/components/Action/Action.mjs';
|
|
6
|
+
export { MutedActionError } from './components/src/components/Action/MutedActionError.mjs';
|
|
6
7
|
export { useAriaAnnounceSuspense } from './components/src/components/Action/lib/ariaLive.mjs';
|
|
7
8
|
export { ActionGroup } from './components/src/components/ActionGroup/ActionGroup.mjs';
|
|
8
9
|
export { Activity } from './components/src/components/Activity/Activity.mjs';
|
package/dist/js/default.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"default.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MutedActionError.d.ts","sourceRoot":"","sources":["../../../../src/components/Action/MutedActionError.ts"],"names":[],"mappings":"AAAA,qBAAa,gBAAiB,SAAQ,KAAK;gBACtB,OAAO,CAAC,EAAE,MAAM;WAKrB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB;WAI7D,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;CAKtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Action/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Action/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionExecution.d.ts","sourceRoot":"","sources":["../../../../../src/components/Action/models/ActionExecution.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"ActionExecution.d.ts","sourceRoot":"","sources":["../../../../../src/components/Action/models/ActionExecution.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAK1E,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAElB,MAAM,EAAE,WAAW;IAI/B,OAAO,GAAI,GAAG,MAAM,OAAO,EAAE,KAAG,IAAI,CAiBzC;IAEF,OAAO,CAAC,iBAAiB,CA+CvB;CACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionExecutionBatch.d.ts","sourceRoot":"","sources":["../../../../../src/components/Action/models/ActionExecutionBatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAI1E,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,SAAgB,UAAU,EAAE,WAAW,CAAC;gBAE5B,UAAU,EAAE,WAAW;IAI5B,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAIpC,YAAY,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE;
|
|
1
|
+
{"version":3,"file":"ActionExecutionBatch.d.ts","sourceRoot":"","sources":["../../../../../src/components/Action/models/ActionExecutionBatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAI1E,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,SAAgB,UAAU,EAAE,WAAW,CAAC;gBAE5B,UAAU,EAAE,WAAW;IAI5B,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI;IAIpC,YAAY,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE;CAyCvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,O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AE,SAAS,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IACzE,yDAAyD;IACzD,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;IACjD,2CAA2C;IAC3C,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC;IACjB,8CAA8C;IAC9C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gDAAgD;IAChD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,kDAAkD;IAClD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kDAAkD;IAClD,UAAU,CAAC,EAAE,OAAO,CAAC;CAKtB;AA+CD,wBAAwB;AACxB,eAAO,MAAM,MAAM,mGA2GjB,CAAC;AAEH,eAAe,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/Form/Form.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,EAAE,EAEP,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,GAAG,EAIT,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,aAAa,EACd,MAAM,iBAAiB,CAAC;AAGzB,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,WAAW,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC;AAE1E,MAAM,MAAM,uBAAuB,GAAG,CAAC,GAAG,WAAW,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;AAE7E,KAAK,iBAAiB,GAAG,EAAE,CACzB,iBAAiB,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,gBAAgB,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACzD,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;CAC5B,CAAC,CACH,CAAC;AAEF,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,WAAW,CAC9C,SAAQ,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,EAAE,iBAAiB;IACnE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACvB,QAAQ,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC,CAAC;IACnD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAID,wBAAgB,IAAI,CAAC,CAAC,SAAS,WAAW,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/react-hook-form/components/Form/Form.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,EAAE,EAEP,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,GAAG,EAIT,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,aAAa,EACd,MAAM,iBAAiB,CAAC;AAGzB,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,WAAW,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC;AAE1E,MAAM,MAAM,uBAAuB,GAAG,CAAC,GAAG,WAAW,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;AAE7E,KAAK,iBAAiB,GAAG,EAAE,CACzB,iBAAiB,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,gBAAgB,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACzD,GAAG,CAAC,EAAE,GAAG,CAAC,eAAe,CAAC,CAAC;CAC5B,CAAC,CACH,CAAC;AAEF,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,WAAW,CAC9C,SAAQ,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,EAAE,iBAAiB;IACnE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACvB,QAAQ,EAAE,mBAAmB,CAAC,CAAC,CAAC,CAAC;IACjC,aAAa,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC,CAAC;IACnD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAID,wBAAgB,IAAI,CAAC,CAAC,SAAS,WAAW,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,2CAmE9D;AAED,eAAe,IAAI,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/flow-react-components",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.677",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A React implementation of Flow, mittwald’s design system",
|
|
6
6
|
"homepage": "https://mittwald.github.io/flow",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@internationalized/string-compiler": "^3.2.6",
|
|
60
60
|
"@mittwald/password-tools-js": "3.0.0-alpha.18",
|
|
61
|
-
"@mittwald/react-tunnel": "0.2.0-alpha.
|
|
61
|
+
"@mittwald/react-tunnel": "0.2.0-alpha.677",
|
|
62
62
|
"@mittwald/react-use-promise": "^4.2.2",
|
|
63
63
|
"@react-aria/form": "^3.1.3",
|
|
64
64
|
"@react-aria/live-announcer": "^3.4.4",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"@faker-js/faker": "^10.2.0",
|
|
105
105
|
"@internationalized/date": "^3.10.1",
|
|
106
106
|
"@mittwald/flow-core": "",
|
|
107
|
-
"@mittwald/flow-design-tokens": "0.2.0-alpha.
|
|
107
|
+
"@mittwald/flow-design-tokens": "0.2.0-alpha.677",
|
|
108
108
|
"@mittwald/react-use-promise": "^4.2.2",
|
|
109
109
|
"@mittwald/remote-dom-react": "1.2.2-mittwald.10",
|
|
110
110
|
"@mittwald/typescript-config": "",
|
|
@@ -172,5 +172,5 @@
|
|
|
172
172
|
"optional": true
|
|
173
173
|
}
|
|
174
174
|
},
|
|
175
|
-
"gitHead": "
|
|
175
|
+
"gitHead": "2295235e58fdee06f17658435f094a943b357585"
|
|
176
176
|
}
|