@activecollab/components 1.0.173 → 1.0.175
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/dist/cjs/components/Typography/Typography.js +1 -1
- package/dist/cjs/components/Typography/Typography.js.map +1 -1
- package/dist/cjs/components/Wizard/Step.js +68 -0
- package/dist/cjs/components/Wizard/Step.js.map +1 -0
- package/dist/cjs/components/Wizard/StepActionButton.js +32 -0
- package/dist/cjs/components/Wizard/StepActionButton.js.map +1 -0
- package/dist/cjs/components/Wizard/Styles.js +39 -0
- package/dist/cjs/components/Wizard/Styles.js.map +1 -0
- package/dist/cjs/components/Wizard/Wizard.js +94 -0
- package/dist/cjs/components/Wizard/Wizard.js.map +1 -0
- package/dist/cjs/components/Wizard/WizardContext.js +23 -0
- package/dist/cjs/components/Wizard/WizardContext.js.map +1 -0
- package/dist/esm/components/Typography/Typography.js +1 -1
- package/dist/esm/components/Typography/Typography.js.map +1 -1
- package/dist/esm/components/Wizard/Step.d.ts +16 -0
- package/dist/esm/components/Wizard/Step.d.ts.map +1 -0
- package/dist/esm/components/Wizard/Step.js +46 -0
- package/dist/esm/components/Wizard/Step.js.map +1 -0
- package/dist/esm/components/Wizard/StepActionButton.d.ts +10 -0
- package/dist/esm/components/Wizard/StepActionButton.d.ts.map +1 -0
- package/dist/esm/components/Wizard/StepActionButton.js +18 -0
- package/dist/esm/components/Wizard/StepActionButton.js.map +1 -0
- package/dist/esm/components/Wizard/Styles.d.ts +5 -0
- package/dist/esm/components/Wizard/Styles.d.ts.map +1 -0
- package/dist/esm/components/Wizard/Styles.js +18 -0
- package/dist/esm/components/Wizard/Styles.js.map +1 -0
- package/dist/esm/components/Wizard/Wizard.d.ts +9 -0
- package/dist/esm/components/Wizard/Wizard.d.ts.map +1 -0
- package/dist/esm/components/Wizard/Wizard.js +62 -0
- package/dist/esm/components/Wizard/Wizard.js.map +1 -0
- package/dist/esm/components/Wizard/WizardContext.d.ts +13 -0
- package/dist/esm/components/Wizard/WizardContext.d.ts.map +1 -0
- package/dist/esm/components/Wizard/WizardContext.js +9 -0
- package/dist/esm/components/Wizard/WizardContext.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import React, { forwardRef, useCallback, useMemo, useState } from "react";
|
|
2
|
+
import { Dialog } from "../Dialog";
|
|
3
|
+
import { Step } from "./Step";
|
|
4
|
+
import { WizardContextProvider } from "./WizardContext";
|
|
5
|
+
export var Wizard = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
6
|
+
var title = _ref.title,
|
|
7
|
+
open = _ref.open,
|
|
8
|
+
onClose = _ref.onClose,
|
|
9
|
+
children = _ref.children;
|
|
10
|
+
var childrenCollection = useMemo(function () {
|
|
11
|
+
return React.Children.toArray(children);
|
|
12
|
+
}, [children]);
|
|
13
|
+
|
|
14
|
+
var _useState = useState(0),
|
|
15
|
+
activeStep = _useState[0],
|
|
16
|
+
setActiveStep = _useState[1];
|
|
17
|
+
|
|
18
|
+
var _useState2 = useState(false),
|
|
19
|
+
changingStepInProgress = _useState2[0],
|
|
20
|
+
setChangingStepInProgress = _useState2[1];
|
|
21
|
+
|
|
22
|
+
var onNextButtonClick = useCallback(function () {
|
|
23
|
+
setActiveStep(activeStep + 1);
|
|
24
|
+
}, [activeStep]);
|
|
25
|
+
var onPreviousButtonClick = useCallback(function () {
|
|
26
|
+
setActiveStep(activeStep - 1);
|
|
27
|
+
}, [activeStep]);
|
|
28
|
+
var onCloseCallback = useCallback(function () {
|
|
29
|
+
setActiveStep(0);
|
|
30
|
+
onClose();
|
|
31
|
+
}, [onClose]);
|
|
32
|
+
var renderActiveStep = useMemo(function () {
|
|
33
|
+
var element = childrenCollection[activeStep];
|
|
34
|
+
|
|
35
|
+
if ((element == null ? void 0 : element.type) === Step) {
|
|
36
|
+
return /*#__PURE__*/React.cloneElement(element, {
|
|
37
|
+
index: activeStep,
|
|
38
|
+
isLast: childrenCollection.length - 1 === activeStep,
|
|
39
|
+
title: title,
|
|
40
|
+
onNextButtonClick: onNextButtonClick,
|
|
41
|
+
onPreviousButtonClick: onPreviousButtonClick,
|
|
42
|
+
onClose: onCloseCallback,
|
|
43
|
+
changingStepInProgress: changingStepInProgress
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return null;
|
|
48
|
+
}, [activeStep, changingStepInProgress, childrenCollection, onCloseCallback, onNextButtonClick, onPreviousButtonClick, title]);
|
|
49
|
+
return /*#__PURE__*/React.createElement(WizardContextProvider, {
|
|
50
|
+
value: {
|
|
51
|
+
activeStep: activeStep,
|
|
52
|
+
setActiveStep: setActiveStep,
|
|
53
|
+
close: onCloseCallback,
|
|
54
|
+
setChangingStepInProgress: setChangingStepInProgress
|
|
55
|
+
}
|
|
56
|
+
}, /*#__PURE__*/React.createElement(Dialog, {
|
|
57
|
+
ref: ref,
|
|
58
|
+
open: open
|
|
59
|
+
}, renderActiveStep));
|
|
60
|
+
});
|
|
61
|
+
Wizard.displayName = "Wizard";
|
|
62
|
+
//# sourceMappingURL=Wizard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Wizard/Wizard.tsx"],"names":["React","forwardRef","useCallback","useMemo","useState","Dialog","Step","WizardContextProvider","Wizard","ref","title","open","onClose","children","childrenCollection","Children","toArray","activeStep","setActiveStep","changingStepInProgress","setChangingStepInProgress","onNextButtonClick","onPreviousButtonClick","onCloseCallback","renderActiveStep","element","type","cloneElement","index","isLast","length","close","displayName"],"mappings":"AAAA,OAAOA,KAAP,IACEC,UADF,EAIEC,WAJF,EAKEC,OALF,EAMEC,QANF,QAOO,OAPP;AAQA,SAASC,MAAT,QAAuB,WAAvB;AACA,SAASC,IAAT,QAAqB,QAArB;AACA,SAASC,qBAAT,QAAsC,iBAAtC;AASA,OAAO,IAAMC,MAA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X,UAD0B;AAEjCY,QAAAA,MAAM,EAAEf,kBAAkB,CAACgB,MAAnB,GAA4B,CAA5B,KAAkCb,UAFT;AAGjCP,QAAAA,KAAK,EAAEA,KAH0B;AAIjCW,QAAAA,iBAAiB,EAAEA,iBAJc;AAKjCC,QAAAA,qBAAqB,EAAEA,qBALU;AAMjCV,QAAAA,OAAO,EAAEW,eANwB;AAOjCJ,QAAAA,sBAAsB,EAAEA;AAPS,OAA5B,CAAP;AASD;;AAED,WAAO,IAAP;AACD,GAhB+B,EAgB7B,CACDF,UADC,EAEDE,sBAFC,EAGDL,kBAHC,EAIDS,eAJC,EAKDF,iBALC,EAMDC,qBANC,EAODZ,KAPC,CAhB6B,CAAhC;AA0BA,sBACE,oBAAC,qBAAD;AACE,IAAA,KAAK,EAAE;AACLO,MAAAA,UAAU,EAAVA,UADK;AAELC,MAAAA,aAAa,EAAbA,aAFK;AAGLa,MAAAA,KAAK,EAAER,eAHF;AAILH,MAAAA,yBAAyB,EAAzBA;AAJK;AADT,kBAQE,oBAAC,MAAD;AAAQ,IAAA,GAAG,EAAEX,GAAb;AAAkB,IAAA,IAAI,EAAEE;AAAxB,KACGa,gBADH,CARF,CADF;AAcD,CA/D6B,CAAzB;AAkEPhB,MAAM,CAACwB,WAAP,GAAqB,QAArB","sourcesContent":["import React, {\n forwardRef,\n ReactElement,\n ReactNode,\n useCallback,\n useMemo,\n useState,\n} from \"react\";\nimport { Dialog } from \"../Dialog\";\nimport { Step } from \"./Step\";\nimport { WizardContextProvider } from \"./WizardContext\";\n\nexport interface IWizard {\n title: string;\n open: boolean;\n onClose: () => void;\n children: ReactNode;\n}\n\nexport const Wizard = forwardRef<HTMLDivElement, IWizard>(\n ({ title, open, onClose, children }, ref) => {\n const childrenCollection = useMemo(\n () => React.Children.toArray(children),\n [children]\n );\n\n const [activeStep, setActiveStep] = useState(0);\n const [changingStepInProgress, setChangingStepInProgress] = useState(false);\n\n const onNextButtonClick = useCallback(() => {\n setActiveStep(activeStep + 1);\n }, [activeStep]);\n\n const onPreviousButtonClick = useCallback(() => {\n setActiveStep(activeStep - 1);\n }, [activeStep]);\n\n const onCloseCallback = useCallback(() => {\n setActiveStep(0);\n onClose();\n }, [onClose]);\n\n const renderActiveStep = useMemo(() => {\n const element = childrenCollection[activeStep] as ReactElement;\n\n if (element?.type === Step) {\n return React.cloneElement(element, {\n index: activeStep,\n isLast: childrenCollection.length - 1 === activeStep,\n title: title,\n onNextButtonClick: onNextButtonClick,\n onPreviousButtonClick: onPreviousButtonClick,\n onClose: onCloseCallback,\n changingStepInProgress: changingStepInProgress,\n });\n }\n\n return null;\n }, [\n activeStep,\n changingStepInProgress,\n childrenCollection,\n onCloseCallback,\n onNextButtonClick,\n onPreviousButtonClick,\n title,\n ]);\n\n return (\n <WizardContextProvider\n value={{\n activeStep,\n setActiveStep,\n close: onCloseCallback,\n setChangingStepInProgress,\n }}\n >\n <Dialog ref={ref} open={open}>\n {renderActiveStep}\n </Dialog>\n </WizardContextProvider>\n );\n }\n);\n\nWizard.displayName = \"Wizard\";\n"],"file":"Wizard.js"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface IWizardContext {
|
|
3
|
+
activeStep?: number;
|
|
4
|
+
setActiveStep?: (integer: any) => void;
|
|
5
|
+
close?: () => void;
|
|
6
|
+
setChangingStepInProgress?: (boolean: any) => void;
|
|
7
|
+
}
|
|
8
|
+
declare const WizardContext: import("react").Context<IWizardContext>;
|
|
9
|
+
export declare const WizardContextProvider: import("react").Provider<IWizardContext>;
|
|
10
|
+
export declare const WizardContextConsumer: import("react").Consumer<IWizardContext>;
|
|
11
|
+
export declare const useWizardContext: () => IWizardContext;
|
|
12
|
+
export default WizardContext;
|
|
13
|
+
//# sourceMappingURL=WizardContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WizardContext.d.ts","sourceRoot":"","sources":["../../../../src/components/Wizard/WizardContext.ts"],"names":[],"mappings":";AAEA,UAAU,cAAc;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,CAAC,OAAO,KAAA,KAAK,IAAI,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IACnB,yBAAyB,CAAC,EAAE,CAAC,OAAO,KAAA,KAAK,IAAI,CAAC;CAC/C;AAED,QAAA,MAAM,aAAa,yCAAoC,CAAC;AAExD,eAAO,MAAM,qBAAqB,0CAAyB,CAAC;AAC5D,eAAO,MAAM,qBAAqB,0CAAyB,CAAC;AAE5D,eAAO,MAAM,gBAAgB,QAAO,cAA2C,CAAC;AAEhF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
var WizardContext = /*#__PURE__*/createContext({});
|
|
3
|
+
export var WizardContextProvider = WizardContext.Provider;
|
|
4
|
+
export var WizardContextConsumer = WizardContext.Consumer;
|
|
5
|
+
export var useWizardContext = function useWizardContext() {
|
|
6
|
+
return useContext(WizardContext);
|
|
7
|
+
};
|
|
8
|
+
export default WizardContext;
|
|
9
|
+
//# sourceMappingURL=WizardContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/Wizard/WizardContext.ts"],"names":["createContext","useContext","WizardContext","WizardContextProvider","Provider","WizardContextConsumer","Consumer","useWizardContext"],"mappings":"AAAA,SAASA,aAAT,EAAwBC,UAAxB,QAA0C,OAA1C;AASA,IAAMC,aAAa,gBAAGF,aAAa,CAAiB,EAAjB,CAAnC;AAEA,OAAO,IAAMG,qBAAqB,GAAGD,aAAa,CAACE,QAA5C;AACP,OAAO,IAAMC,qBAAqB,GAAGH,aAAa,CAACI,QAA5C;AAEP,OAAO,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB;AAAA,SAAsBN,UAAU,CAACC,aAAD,CAAhC;AAAA,CAAzB;AAEP,eAAeA,aAAf","sourcesContent":["import { createContext, useContext } from \"react\";\n\ninterface IWizardContext {\n activeStep?: number;\n setActiveStep?: (integer) => void;\n close?: () => void;\n setChangingStepInProgress?: (boolean) => void;\n}\n\nconst WizardContext = createContext<IWizardContext>({});\n\nexport const WizardContextProvider = WizardContext.Provider;\nexport const WizardContextConsumer = WizardContext.Consumer;\n\nexport const useWizardContext = (): IWizardContext => useContext(WizardContext);\n\nexport default WizardContext;\n"],"file":"WizardContext.js"}
|
package/dist/index.js
CHANGED
|
@@ -1074,7 +1074,7 @@
|
|
|
1074
1074
|
_ref$tabularNums = _ref.tabularNums,
|
|
1075
1075
|
tabularNums = _ref$tabularNums === void 0 ? false : _ref$tabularNums,
|
|
1076
1076
|
_ref$letterSpacing = _ref.letterSpacing,
|
|
1077
|
-
letterSpacing = _ref$letterSpacing === void 0 ? "
|
|
1077
|
+
letterSpacing = _ref$letterSpacing === void 0 ? "tight" : _ref$letterSpacing,
|
|
1078
1078
|
_ref$lineHeight = _ref.lineHeight,
|
|
1079
1079
|
lineHeight = _ref$lineHeight === void 0 ? "regular" : _ref$lineHeight,
|
|
1080
1080
|
_ref$align = _ref.align,
|