allaw-ui 0.1.1 → 0.1.4
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/README.md +0 -0
- package/dist/app/globals.css +0 -0
- package/dist/assets/NoPhoto.png +0 -0
- package/dist/assets/NoPhoto.svg +0 -0
- package/dist/assets/allaw-font.eot +0 -0
- package/dist/assets/allaw-font.svg +0 -0
- package/dist/assets/allaw-font.ttf +0 -0
- package/dist/assets/allaw-font.woff +0 -0
- package/dist/components/atoms/buttons/ActionCircleButton.css +0 -0
- package/dist/components/atoms/buttons/AgendaSlot.css +0 -0
- package/dist/components/atoms/buttons/FavoriteToggle.css +0 -0
- package/dist/components/atoms/buttons/FilterButton.css +0 -0
- package/dist/components/atoms/buttons/GhostButton.css +0 -0
- package/dist/components/atoms/buttons/IconButton.css +0 -0
- package/dist/components/atoms/buttons/IconButton.d.ts +1 -0
- package/dist/components/atoms/buttons/IconButton.js +2 -2
- package/dist/components/atoms/buttons/OAuthProviderButton.css +0 -0
- package/dist/components/atoms/buttons/PendingDocuments.css +0 -0
- package/dist/components/atoms/buttons/PrimaryButton.css +24 -0
- package/dist/components/atoms/buttons/PrimaryButton.d.ts +2 -1
- package/dist/components/atoms/buttons/PrimaryButton.js +85 -4
- package/dist/components/atoms/buttons/SecondaryButton.css +0 -0
- package/dist/components/atoms/buttons/SecondaryButton.d.ts +8 -4
- package/dist/components/atoms/buttons/SecondaryButton.js +113 -7
- package/dist/components/atoms/buttons/TabNavigation.css +0 -0
- package/dist/components/atoms/buttons/TertiaryButton.css +0 -0
- package/dist/components/atoms/checkboxes/Checkbox.css +0 -0
- package/dist/components/atoms/checkboxes/Checkbox.d.ts +1 -0
- package/dist/components/atoms/checkboxes/Checkbox.js +3 -3
- package/dist/components/atoms/filter/Basefiler.css +0 -0
- package/dist/components/atoms/filters/SingleFilter.css +0 -0
- package/dist/components/atoms/filters/SingleFilter.d.ts +5 -2
- package/dist/components/atoms/filters/SingleFilter.js +32 -23
- package/dist/components/atoms/inputs/Input.css +0 -0
- package/dist/components/atoms/inputs/SearchBar.css +0 -0
- package/dist/components/atoms/inputs/TextArea.css +202 -0
- package/dist/components/atoms/inputs/TextArea.d.ts +22 -0
- package/dist/components/atoms/inputs/TextArea.js +79 -0
- package/dist/components/atoms/inputs/index.d.ts +2 -0
- package/dist/components/atoms/inputs/index.js +1 -0
- package/dist/components/atoms/progressBars/ProgressBar.css +0 -0
- package/dist/components/atoms/progressBars/ProgressBar.js +5 -4
- package/dist/components/atoms/radios/RadioButton.css +0 -0
- package/dist/components/atoms/selects/Select.css +16 -3
- package/dist/components/atoms/selects/Select.d.ts +1 -0
- package/dist/components/atoms/selects/Select.js +20 -8
- package/dist/components/atoms/tags/AppointementStatusTag.css +0 -0
- package/dist/components/atoms/tags/FolderStatusTag.css +0 -0
- package/dist/components/atoms/tags/OtherStatusTag.css +0 -0
- package/dist/components/atoms/typography/Heading.css +0 -0
- package/dist/components/atoms/typography/Paragraph.css +0 -0
- package/dist/components/atoms/typography/SmallTitle.css +0 -0
- package/dist/components/atoms/typography/Subtitle.css +0 -0
- package/dist/components/atoms/typography/TinyInfo.css +3 -0
- package/dist/components/atoms/typography/TinyInfo.d.ts +1 -1
- package/dist/components/atoms/uiVariables/BorderRadiusExample.css +0 -0
- package/dist/components/atoms/uiVariables/ShadowsExample.css +0 -0
- package/dist/components/atoms/uiVariables/StrokesExample.css +0 -0
- package/dist/components/molecules/appointmentSlot/AppointmentSlot.css +0 -0
- package/dist/components/molecules/breadcrumb/Breadcrumb.css +0 -0
- package/dist/components/molecules/caseCard/CaseCard.css +0 -0
- package/dist/components/molecules/caseLinkCard/CaseLinkCard.css +47 -0
- package/dist/components/molecules/caseLinkCard/CaseLinkCard.d.ts +10 -0
- package/dist/components/molecules/caseLinkCard/CaseLinkCard.js +27 -0
- package/dist/components/molecules/caseLinkCard/index.d.ts +2 -0
- package/dist/components/molecules/caseLinkCard/index.js +1 -0
- package/dist/components/molecules/checkboxForm/CheckboxForm.css +0 -0
- package/dist/components/molecules/checkboxForm/CheckboxForm.d.ts +1 -0
- package/dist/components/molecules/checkboxForm/CheckboxForm.js +2 -2
- package/dist/components/molecules/contactCard/ContactCard.css +2 -2
- package/dist/components/molecules/documentCard/DocumentCard.css +2 -2
- package/dist/components/molecules/documentCard/DocumentCard.d.ts +2 -1
- package/dist/components/molecules/documentCard/DocumentCard.js +18 -5
- package/dist/components/molecules/employeeCard/EmployeeCard.css +0 -0
- package/dist/components/molecules/proCard/ProCard.css +0 -0
- package/dist/components/molecules/proCard/ProCard.js +2 -2
- package/dist/components/molecules/radioForm/RadioForm.css +14 -0
- package/dist/components/molecules/radioForm/RadioForm.d.ts +12 -0
- package/dist/components/molecules/radioForm/RadioForm.js +27 -0
- package/dist/components/molecules/radioForm/index.d.ts +2 -0
- package/dist/components/molecules/radioForm/index.js +1 -0
- package/dist/components/molecules/selectForm/SelectForm.css +9 -0
- package/dist/components/molecules/selectForm/SelectForm.d.ts +15 -0
- package/dist/components/molecules/selectForm/SelectForm.js +15 -0
- package/dist/components/molecules/selectForm/index.d.ts +2 -0
- package/dist/components/molecules/selectForm/index.js +1 -0
- package/dist/components/molecules/stepper/Stepper.css +12 -1
- package/dist/components/molecules/stepper/Stepper.d.ts +9 -2
- package/dist/components/molecules/stepper/Stepper.js +90 -35
- package/dist/index.d.ts +6 -0
- package/dist/index.js +7 -0
- package/dist/stories/assets/accessibility.png +0 -0
- package/dist/stories/assets/accessibility.svg +0 -0
- package/dist/stories/assets/addon-library.png +0 -0
- package/dist/stories/assets/assets.png +0 -0
- package/dist/stories/assets/context.png +0 -0
- package/dist/stories/assets/discord.svg +0 -0
- package/dist/stories/assets/docs.png +0 -0
- package/dist/stories/assets/figma-plugin.png +0 -0
- package/dist/stories/assets/github.svg +0 -0
- package/dist/stories/assets/share.png +0 -0
- package/dist/stories/assets/styling.png +0 -0
- package/dist/stories/assets/testing.png +0 -0
- package/dist/stories/assets/theming.png +0 -0
- package/dist/stories/assets/tutorials.svg +0 -0
- package/dist/stories/assets/youtube.svg +0 -0
- package/dist/styles/colors.css +0 -0
- package/dist/styles/global.css +0 -0
- package/dist/styles/icons.css +0 -0
- package/dist/styles/ui-variables/border-radius.css +0 -0
- package/dist/styles/ui-variables/shadows.css +0 -0
- package/dist/styles/ui-variables/stroke.css +0 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
.document-card {
|
|
4
4
|
display: flex;
|
|
5
|
-
width:
|
|
5
|
+
width: 100%;
|
|
6
6
|
padding: 16px;
|
|
7
7
|
justify-content: space-between;
|
|
8
8
|
align-items: flex-start;
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
.document-card-left {
|
|
16
16
|
display: flex;
|
|
17
17
|
align-items: center;
|
|
18
|
-
gap:
|
|
18
|
+
gap: 16px;
|
|
19
19
|
align-self: stretch;
|
|
20
20
|
}
|
|
21
21
|
|
|
@@ -4,10 +4,11 @@ export interface DocumentCardProps {
|
|
|
4
4
|
type: "document" | "note" | "invoice" | "waiting";
|
|
5
5
|
title: string;
|
|
6
6
|
date: Date;
|
|
7
|
-
status: "sent" | "received";
|
|
7
|
+
status: "sent" | "received" | "internal";
|
|
8
8
|
documents?: {
|
|
9
9
|
[key: string]: boolean;
|
|
10
10
|
};
|
|
11
|
+
onCardClick?: () => any;
|
|
11
12
|
documentCount?: string;
|
|
12
13
|
}
|
|
13
14
|
declare const DocumentCard: React.FC<DocumentCardProps>;
|
|
@@ -2,8 +2,9 @@ import React from "react";
|
|
|
2
2
|
import "./DocumentCard.css";
|
|
3
3
|
import IconButton from "../../atoms/buttons/IconButton";
|
|
4
4
|
import OtherStatusTag from "../../atoms/tags/OtherStatusTag";
|
|
5
|
+
import { Paragraph } from "../../atoms/typography";
|
|
5
6
|
var DocumentCard = function (_a) {
|
|
6
|
-
var type = _a.type, title = _a.title, date = _a.date, status = _a.status, _b = _a.documents, documents = _b === void 0 ? {} : _b, _c = _a.documentCount, documentCount = _c === void 0 ? "" : _c;
|
|
7
|
+
var type = _a.type, title = _a.title, date = _a.date, onCardClick = _a.onCardClick, status = _a.status, _b = _a.documents, documents = _b === void 0 ? {} : _b, _c = _a.documentCount, documentCount = _c === void 0 ? "" : _c;
|
|
7
8
|
var getIconName = function () {
|
|
8
9
|
switch (type) {
|
|
9
10
|
case "document":
|
|
@@ -18,6 +19,18 @@ var DocumentCard = function (_a) {
|
|
|
18
19
|
return "allaw-icon-document";
|
|
19
20
|
}
|
|
20
21
|
};
|
|
22
|
+
var getStatusName = function () {
|
|
23
|
+
switch (status) {
|
|
24
|
+
case "internal":
|
|
25
|
+
return "INTERNE";
|
|
26
|
+
case "received":
|
|
27
|
+
return "REÇU";
|
|
28
|
+
case "sent":
|
|
29
|
+
return "ENVOYÉ";
|
|
30
|
+
default:
|
|
31
|
+
return "INTERNE";
|
|
32
|
+
}
|
|
33
|
+
};
|
|
21
34
|
var getDisplayType = function (type) {
|
|
22
35
|
if (type === "invoice") {
|
|
23
36
|
return "FACTURE";
|
|
@@ -33,7 +46,7 @@ var DocumentCard = function (_a) {
|
|
|
33
46
|
};
|
|
34
47
|
if (type === "waiting") {
|
|
35
48
|
var documentList = Object.keys(documents);
|
|
36
|
-
return (React.createElement("div", { className: "document-card waiting" },
|
|
49
|
+
return (React.createElement("div", { className: "document-card waiting", style: { cursor: onCardClick ? "pointer" : "default" }, onClick: function () { return onCardClick && onCardClick(); } },
|
|
37
50
|
React.createElement("div", { className: "document-card-left" },
|
|
38
51
|
React.createElement(OtherStatusTag, { type: "information", label: "Documents demand\u00E9s pour ce rendez-vous" }),
|
|
39
52
|
React.createElement("h3", { className: "document-card-title" }, title),
|
|
@@ -46,14 +59,14 @@ var DocumentCard = function (_a) {
|
|
|
46
59
|
React.createElement(IconButton, { style: "smallFilled", iconName: "allaw-icon-document" }),
|
|
47
60
|
React.createElement("span", { className: "document-count" }, documentCount))));
|
|
48
61
|
}
|
|
49
|
-
return (React.createElement("div", { className: "document-card" },
|
|
62
|
+
return (React.createElement("div", { className: "document-card", onClick: function () { return onCardClick && onCardClick(); }, style: { cursor: onCardClick ? "pointer" : "default" } },
|
|
50
63
|
React.createElement("div", { className: "document-card-left" },
|
|
51
64
|
React.createElement(IconButton, { style: "largeFilled", iconName: getIconName() }),
|
|
52
65
|
React.createElement("div", { className: "document-card-info" },
|
|
53
66
|
React.createElement("span", { className: "document-card-type" }, getDisplayType(type)),
|
|
54
|
-
React.createElement("
|
|
67
|
+
React.createElement(Paragraph, { text: title, variant: "semiBold", size: "default", maxLines: 1, color: "noir" }),
|
|
55
68
|
React.createElement("span", { className: "document-card-date" }, formatDate(date)))),
|
|
56
69
|
React.createElement("div", { className: "document-card-right" },
|
|
57
|
-
React.createElement(OtherStatusTag, { type: "information", label:
|
|
70
|
+
React.createElement(OtherStatusTag, { type: "information", label: getStatusName() }))));
|
|
58
71
|
};
|
|
59
72
|
export default DocumentCard;
|
|
File without changes
|
|
File without changes
|
|
@@ -18,8 +18,8 @@ var ProCard = function (_a) {
|
|
|
18
18
|
React.createElement(OtherStatusTag, { label: uppercaseJob, type: "information" }),
|
|
19
19
|
React.createElement("h3", { className: "pro-card-name" },
|
|
20
20
|
React.createElement("a", { href: profileUrl }, "".concat(firstName, " ").concat(lastName))))),
|
|
21
|
-
React.createElement("div", { className: "pro-card-address" },
|
|
21
|
+
address && /[a-zA-Z0-9]/.test(address) && (React.createElement("div", { className: "pro-card-address" },
|
|
22
22
|
React.createElement("i", { className: "icon allaw-icon-map-pin" }),
|
|
23
|
-
React.createElement("span", null, address)))));
|
|
23
|
+
React.createElement("span", null, address))))));
|
|
24
24
|
};
|
|
25
25
|
export default ProCard;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./RadioForm.css";
|
|
3
|
+
import "../../../styles/global.css";
|
|
4
|
+
export interface RadioFormProps {
|
|
5
|
+
label: string;
|
|
6
|
+
isRequired: boolean;
|
|
7
|
+
options: string[];
|
|
8
|
+
defaultSelected?: string;
|
|
9
|
+
onChange?: (selectedOption: string | null) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const RadioForm: React.FC<RadioFormProps>;
|
|
12
|
+
export default RadioForm;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import "./RadioForm.css";
|
|
3
|
+
import "../../../styles/global.css";
|
|
4
|
+
import Paragraph from "../../atoms/typography/Paragraph";
|
|
5
|
+
import RadioButton from "../../atoms/radios/RadioButton";
|
|
6
|
+
var RadioForm = function (_a) {
|
|
7
|
+
var label = _a.label, isRequired = _a.isRequired, options = _a.options, defaultSelected = _a.defaultSelected, onChange = _a.onChange;
|
|
8
|
+
var _b = useState(defaultSelected || null), selectedOption = _b[0], setSelectedOption = _b[1];
|
|
9
|
+
useEffect(function () {
|
|
10
|
+
if (defaultSelected) {
|
|
11
|
+
setSelectedOption(defaultSelected);
|
|
12
|
+
}
|
|
13
|
+
}, [defaultSelected]);
|
|
14
|
+
var handleOptionChange = function (option) {
|
|
15
|
+
setSelectedOption(option);
|
|
16
|
+
if (onChange) {
|
|
17
|
+
onChange(option);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
return (React.createElement("div", { className: "radio-form" },
|
|
21
|
+
React.createElement(Paragraph, { variant: "medium", color: "noir", text: React.createElement(React.Fragment, null,
|
|
22
|
+
label,
|
|
23
|
+
" ",
|
|
24
|
+
isRequired && React.createElement("span", { className: "radio-form-required" }, "*")), size: "default" }),
|
|
25
|
+
React.createElement("div", { className: "radio-form-options" }, options.map(function (option, index) { return (React.createElement(RadioButton, { key: index, label: option, style: "hybride", isActive: selectedOption === option, onClick: function () { return handleOptionChange(option); } })); }))));
|
|
26
|
+
};
|
|
27
|
+
export default RadioForm;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as RadioForm } from "./RadioForm";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./SelectForm.css";
|
|
3
|
+
import "../../../styles/global.css";
|
|
4
|
+
import { SelectItem } from "../../atoms/selects/Select";
|
|
5
|
+
export interface SelectFormProps {
|
|
6
|
+
label: string;
|
|
7
|
+
isRequired: boolean;
|
|
8
|
+
options: SelectItem[];
|
|
9
|
+
isMultiple: boolean;
|
|
10
|
+
width?: number;
|
|
11
|
+
selectedItem?: string | string[];
|
|
12
|
+
onChange?: (selected: string | string[]) => void;
|
|
13
|
+
}
|
|
14
|
+
declare const SelectForm: React.FC<SelectFormProps>;
|
|
15
|
+
export default SelectForm;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./SelectForm.css";
|
|
3
|
+
import "../../../styles/global.css";
|
|
4
|
+
import Paragraph from "../../atoms/typography/Paragraph";
|
|
5
|
+
import Select from "../../atoms/selects/Select";
|
|
6
|
+
var SelectForm = function (_a) {
|
|
7
|
+
var label = _a.label, isRequired = _a.isRequired, options = _a.options, isMultiple = _a.isMultiple, _b = _a.width, width = _b === void 0 ? 100 : _b, selectedItem = _a.selectedItem, onChange = _a.onChange;
|
|
8
|
+
return (React.createElement("div", { className: "select-form" },
|
|
9
|
+
React.createElement(Paragraph, { variant: "medium", color: "noir", text: React.createElement(React.Fragment, null,
|
|
10
|
+
label,
|
|
11
|
+
" ",
|
|
12
|
+
isRequired && React.createElement("span", { className: "select-form-required" }, "*")), size: "default" }),
|
|
13
|
+
React.createElement(Select, { items: options, multiple: isMultiple, isRequired: isRequired, width: width, selectedItem: selectedItem, onChange: onChange })));
|
|
14
|
+
};
|
|
15
|
+
export default SelectForm;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SelectForm } from "./SelectForm";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
.stepper-container {
|
|
2
2
|
display: flex;
|
|
3
|
-
width:
|
|
3
|
+
width: 100vw;
|
|
4
|
+
max-width: 768px;
|
|
4
5
|
padding: 48px;
|
|
5
6
|
flex-direction: column;
|
|
6
7
|
justify-content: center;
|
|
@@ -65,6 +66,16 @@
|
|
|
65
66
|
display: flex;
|
|
66
67
|
justify-content: center;
|
|
67
68
|
align-items: center;
|
|
69
|
+
opacity: 0;
|
|
70
|
+
visibility: hidden;
|
|
71
|
+
transition:
|
|
72
|
+
opacity 0.3s ease,
|
|
73
|
+
visibility 0.3s ease;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.stepper-overlay.visible {
|
|
77
|
+
opacity: 1;
|
|
78
|
+
visibility: visible;
|
|
68
79
|
}
|
|
69
80
|
|
|
70
81
|
.stepper-content {
|
|
@@ -11,17 +11,24 @@ export interface StepperProps {
|
|
|
11
11
|
secondaryButton?: {
|
|
12
12
|
show: boolean;
|
|
13
13
|
label: string;
|
|
14
|
-
|
|
14
|
+
startIcon?: React.ReactNode;
|
|
15
|
+
endIcon?: React.ReactNode;
|
|
16
|
+
startIconName?: string;
|
|
17
|
+
endIconName?: string;
|
|
15
18
|
onSecondaryButtonClick?: (step: number) => void;
|
|
16
19
|
}[];
|
|
17
20
|
primaryButton?: {
|
|
18
21
|
show: boolean;
|
|
19
22
|
label: string;
|
|
23
|
+
startIcon?: React.ReactNode;
|
|
24
|
+
endIcon?: React.ReactNode;
|
|
25
|
+
startIconName?: string;
|
|
26
|
+
endIconName?: string;
|
|
20
27
|
onPrimaryButtonClick?: (step: number) => void;
|
|
21
28
|
}[];
|
|
22
29
|
showProgressBar?: boolean[];
|
|
23
30
|
onClose?: () => void;
|
|
24
|
-
validateStep?: (step: number) => boolean
|
|
31
|
+
validateStep?: (step: number) => boolean | Promise<boolean>;
|
|
25
32
|
}
|
|
26
33
|
declare const Stepper: React.FC<StepperProps>;
|
|
27
34
|
export default Stepper;
|
|
@@ -1,4 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
import React, { useState, useEffect, useCallback, useRef } from "react";
|
|
2
39
|
import ReactDOM from "react-dom";
|
|
3
40
|
import "./Stepper.css";
|
|
4
41
|
import "../../../styles/global.css";
|
|
@@ -8,61 +45,79 @@ import PrimaryButton from "../../atoms/buttons/PrimaryButton";
|
|
|
8
45
|
import SecondaryButton from "../../atoms/buttons/SecondaryButton";
|
|
9
46
|
var Stepper = function (_a) {
|
|
10
47
|
var steps = _a.steps, currentStep = _a.currentStep, _b = _a.startIcon, startIcon = _b === void 0 ? [] : _b, _c = _a.endIcon, endIcon = _c === void 0 ? true : _c, children = _a.children, _d = _a.secondaryButton, secondaryButton = _d === void 0 ? [] : _d, _e = _a.primaryButton, primaryButton = _e === void 0 ? [] : _e, _f = _a.showProgressBar, showProgressBar = _f === void 0 ? [] : _f, onClose = _a.onClose, validateStep = _a.validateStep;
|
|
11
|
-
var _g = useState(currentStep), step = _g[0], setStep = _g[1];
|
|
12
|
-
var _h = useState(
|
|
48
|
+
var _g = useState(currentStep || 1), step = _g[0], setStep = _g[1];
|
|
49
|
+
var _h = useState(false), isVisible = _h[0], setIsVisible = _h[1];
|
|
50
|
+
var portalContainerRef = useRef(null);
|
|
13
51
|
useEffect(function () {
|
|
14
52
|
var container = document.createElement("div");
|
|
15
53
|
document.body.appendChild(container);
|
|
16
|
-
|
|
54
|
+
portalContainerRef.current = container;
|
|
55
|
+
setIsVisible(true);
|
|
17
56
|
return function () {
|
|
18
|
-
|
|
57
|
+
setIsVisible(false);
|
|
58
|
+
if (portalContainerRef.current &&
|
|
59
|
+
document.body.contains(portalContainerRef.current)) {
|
|
60
|
+
document.body.removeChild(portalContainerRef.current);
|
|
61
|
+
}
|
|
19
62
|
};
|
|
20
63
|
}, []);
|
|
21
64
|
useEffect(function () {
|
|
22
|
-
setStep(currentStep);
|
|
65
|
+
setStep(currentStep || 1);
|
|
23
66
|
}, [currentStep]);
|
|
24
|
-
var handleNext = useCallback(function () {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
67
|
+
var handleNext = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
68
|
+
var currentPrimaryButton, isValid;
|
|
69
|
+
return __generator(this, function (_a) {
|
|
70
|
+
switch (_a.label) {
|
|
71
|
+
case 0:
|
|
72
|
+
currentPrimaryButton = primaryButton[step - 1];
|
|
73
|
+
if (currentPrimaryButton === null || currentPrimaryButton === void 0 ? void 0 : currentPrimaryButton.onPrimaryButtonClick) {
|
|
74
|
+
currentPrimaryButton.onPrimaryButtonClick(step);
|
|
75
|
+
}
|
|
76
|
+
if (!validateStep) return [3 /*break*/, 2];
|
|
77
|
+
return [4 /*yield*/, validateStep(step)];
|
|
78
|
+
case 1:
|
|
79
|
+
isValid = _a.sent();
|
|
80
|
+
if (!isValid) {
|
|
81
|
+
return [2 /*return*/];
|
|
82
|
+
}
|
|
83
|
+
_a.label = 2;
|
|
84
|
+
case 2:
|
|
85
|
+
if (step < steps) {
|
|
86
|
+
setStep(step + 1);
|
|
87
|
+
}
|
|
88
|
+
else if (step === steps && onClose) {
|
|
89
|
+
onClose();
|
|
90
|
+
}
|
|
91
|
+
return [2 /*return*/];
|
|
37
92
|
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
setStep(step + 1);
|
|
41
|
-
}
|
|
42
|
-
else if (step === steps && onClose) {
|
|
43
|
-
onClose();
|
|
44
|
-
}
|
|
45
|
-
}, [step, steps, validateStep, primaryButton, onClose]);
|
|
93
|
+
});
|
|
94
|
+
}); }, [step, steps, validateStep, primaryButton, onClose]);
|
|
46
95
|
var handlePrevious = useCallback(function () {
|
|
47
96
|
if (step > 1) {
|
|
48
97
|
setStep(step - 1);
|
|
49
98
|
}
|
|
50
99
|
}, [step]);
|
|
51
|
-
var currentSecondaryButton = secondaryButton[step - 1];
|
|
52
|
-
var currentPrimaryButton = primaryButton[step - 1];
|
|
100
|
+
var currentSecondaryButton = secondaryButton[step - 1] || {};
|
|
101
|
+
var currentPrimaryButton = primaryButton[step - 1] || {};
|
|
53
102
|
var currentShowProgressBar = showProgressBar[step - 1] !== false;
|
|
54
103
|
var currentShowStartIcon = startIcon[step - 1];
|
|
55
|
-
var
|
|
104
|
+
var handleClose = useCallback(function () {
|
|
105
|
+
setIsVisible(false);
|
|
106
|
+
if (onClose) {
|
|
107
|
+
onClose();
|
|
108
|
+
}
|
|
109
|
+
}, [onClose]);
|
|
110
|
+
var stepperContent = (React.createElement("div", { className: "stepper-overlay ".concat(isVisible ? "visible" : ""), onClick: handleClose },
|
|
56
111
|
React.createElement("div", { className: "stepper-container", onClick: function (e) { return e.stopPropagation(); } },
|
|
57
|
-
React.createElement(ProgressBar, { steps: steps, currentStep: step, startIcon: currentShowStartIcon, endIcon: endIcon, onStartIconClick: handlePrevious, onEndIconClick:
|
|
112
|
+
React.createElement(ProgressBar, { steps: steps, currentStep: step, startIcon: currentShowStartIcon, endIcon: endIcon, onStartIconClick: handlePrevious, onEndIconClick: handleClose, showProgressBar: currentShowProgressBar }),
|
|
58
113
|
React.createElement("div", { className: "stepper-content" }, children[step - 1]),
|
|
59
114
|
React.createElement("div", { className: "stepper-buttons ".concat(!(currentSecondaryButton === null || currentSecondaryButton === void 0 ? void 0 : currentSecondaryButton.show) && !(currentPrimaryButton === null || currentPrimaryButton === void 0 ? void 0 : currentPrimaryButton.show) ? "no-buttons" : "") },
|
|
60
115
|
(currentSecondaryButton === null || currentSecondaryButton === void 0 ? void 0 : currentSecondaryButton.show) && (React.createElement("div", { className: "stepper-button-container secondary-button-container" },
|
|
61
|
-
React.createElement(SecondaryButton, { label: currentSecondaryButton.label, startIcon: currentSecondaryButton.
|
|
116
|
+
React.createElement(SecondaryButton, { label: currentSecondaryButton.label, startIcon: currentSecondaryButton.startIconName ? true : undefined, endIcon: currentSecondaryButton.endIconName ? true : undefined, startIconName: currentSecondaryButton.startIconName, endIconName: currentSecondaryButton.endIconName, onClick: function () { var _a; return (_a = currentSecondaryButton.onSecondaryButtonClick) === null || _a === void 0 ? void 0 : _a.call(currentSecondaryButton, step); } }))),
|
|
62
117
|
(currentPrimaryButton === null || currentPrimaryButton === void 0 ? void 0 : currentPrimaryButton.show) && (React.createElement("div", { className: "stepper-button-container primary-button-container" },
|
|
63
|
-
React.createElement(PrimaryButton, { label: currentPrimaryButton.label, onClick: handleNext })))))));
|
|
64
|
-
return
|
|
65
|
-
? ReactDOM.createPortal(stepperContent,
|
|
118
|
+
React.createElement(PrimaryButton, { label: currentPrimaryButton.label, startIcon: currentPrimaryButton.startIconName ? true : undefined, endIcon: currentPrimaryButton.endIconName ? true : undefined, startIconName: currentPrimaryButton.startIconName, endIconName: currentPrimaryButton.endIconName, onClick: handleNext })))))));
|
|
119
|
+
return portalContainerRef.current && isVisible
|
|
120
|
+
? ReactDOM.createPortal(stepperContent, portalContainerRef.current)
|
|
66
121
|
: null;
|
|
67
122
|
};
|
|
68
123
|
export default Stepper;
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export { default as Checkbox } from "./components/atoms/checkboxes/Checkbox";
|
|
|
13
13
|
export { default as Fitler } from "./components/atoms/filter/Filter";
|
|
14
14
|
export { default as Input } from "./components/atoms/inputs/Input";
|
|
15
15
|
export type { InputProps, InputRef } from "./components/atoms/inputs/Input";
|
|
16
|
+
export { default as TextArea } from "./components/atoms/inputs/TextArea";
|
|
17
|
+
export type { TextAreaProps, TextAreaRef, } from "./components/atoms/inputs/TextArea";
|
|
16
18
|
export { default as SearchBar } from "./components/atoms/inputs/SearchBar";
|
|
17
19
|
export { default as ProgressBar } from "./components/atoms/progressBars/ProgressBar";
|
|
18
20
|
export { default as RadioButton } from "./components/atoms/radios/RadioButton";
|
|
@@ -33,9 +35,13 @@ export { default as Strokes } from "./components/atoms/uiVariables/Strokes";
|
|
|
33
35
|
export { default as AppointmentSlot } from "./components/molecules/appointmentSlot/AppointmentSlot";
|
|
34
36
|
export { default as CaseCard } from "./components/molecules/caseCard/CaseCard";
|
|
35
37
|
export { default as ContactCard } from "./components/molecules/contactCard/ContactCard";
|
|
38
|
+
export { default as CaseCardLink } from "./components/molecules/caseLinkCard/CaseLinkCard";
|
|
36
39
|
export { default as DocumentCard } from "./components/molecules/documentCard/DocumentCard";
|
|
37
40
|
export { default as EmployeeCard } from "./components/molecules/employeeCard/EmployeeCard";
|
|
38
41
|
export { default as Stepper } from "./components/molecules/stepper/Stepper";
|
|
42
|
+
export type { StepperProps } from "./components/molecules/stepper/Stepper";
|
|
39
43
|
export { default as CheckboxForm } from "./components/molecules/checkboxForm/CheckboxForm";
|
|
44
|
+
export { default as RadioForm } from "./components/molecules/radioForm/RadioForm";
|
|
45
|
+
export { default as SelectForm } from "./components/molecules/selectForm/SelectForm";
|
|
40
46
|
export { default as Breadcrumb } from "./components/molecules/breadcrumb/Breadcrumb";
|
|
41
47
|
export { default as ProCard } from "./components/molecules/proCard/ProCard";
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,7 @@ export { default as Checkbox } from "./components/atoms/checkboxes/Checkbox";
|
|
|
17
17
|
export { default as Fitler } from "./components/atoms/filter/Filter";
|
|
18
18
|
// Inputs
|
|
19
19
|
export { default as Input } from "./components/atoms/inputs/Input";
|
|
20
|
+
export { default as TextArea } from "./components/atoms/inputs/TextArea";
|
|
20
21
|
export { default as SearchBar } from "./components/atoms/inputs/SearchBar";
|
|
21
22
|
// Progress Bars
|
|
22
23
|
export { default as ProgressBar } from "./components/atoms/progressBars/ProgressBar";
|
|
@@ -46,6 +47,8 @@ export { default as AppointmentSlot } from "./components/molecules/appointmentSl
|
|
|
46
47
|
export { default as CaseCard } from "./components/molecules/caseCard/CaseCard";
|
|
47
48
|
// Contact Card
|
|
48
49
|
export { default as ContactCard } from "./components/molecules/contactCard/ContactCard";
|
|
50
|
+
// Case Link Card
|
|
51
|
+
export { default as CaseCardLink } from "./components/molecules/caseLinkCard/CaseLinkCard";
|
|
49
52
|
// Document Card
|
|
50
53
|
export { default as DocumentCard } from "./components/molecules/documentCard/DocumentCard";
|
|
51
54
|
// Employee Card
|
|
@@ -54,6 +57,10 @@ export { default as EmployeeCard } from "./components/molecules/employeeCard/Emp
|
|
|
54
57
|
export { default as Stepper } from "./components/molecules/stepper/Stepper";
|
|
55
58
|
// CheckboxForm
|
|
56
59
|
export { default as CheckboxForm } from "./components/molecules/checkboxForm/CheckboxForm";
|
|
60
|
+
// RadioForm
|
|
61
|
+
export { default as RadioForm } from "./components/molecules/radioForm/RadioForm";
|
|
62
|
+
// SelectForm
|
|
63
|
+
export { default as SelectForm } from "./components/molecules/selectForm/SelectForm";
|
|
57
64
|
// Breadcrumb
|
|
58
65
|
export { default as Breadcrumb } from "./components/molecules/breadcrumb/Breadcrumb";
|
|
59
66
|
// ProCard
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/styles/colors.css
CHANGED
|
File without changes
|
package/dist/styles/global.css
CHANGED
|
File without changes
|
package/dist/styles/icons.css
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|