allaw-ui 0.1.71 → 1.0.2

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 (154) hide show
  1. package/dist/components/atoms/buttons/ActionCircleButton.d.ts +9 -0
  2. package/dist/components/atoms/buttons/ActionCircleButton.js +23 -0
  3. package/dist/components/atoms/buttons/AgendaSlot.d.ts +10 -0
  4. package/dist/components/atoms/buttons/AgendaSlot.js +7 -0
  5. package/dist/components/atoms/buttons/FavoriteToggle.d.ts +8 -0
  6. package/dist/components/atoms/buttons/FavoriteToggle.js +11 -0
  7. package/dist/components/atoms/buttons/FilterButton.d.ts +9 -0
  8. package/dist/components/atoms/buttons/FilterButton.js +9 -0
  9. package/dist/components/atoms/buttons/FilterButtonPrimary.d.ts +9 -0
  10. package/dist/components/atoms/buttons/FilterButtonPrimary.js +46 -0
  11. package/dist/components/atoms/buttons/GhostButton.d.ts +14 -0
  12. package/dist/components/atoms/buttons/GhostButton.js +11 -0
  13. package/dist/components/atoms/buttons/IconButton.d.ts +11 -0
  14. package/dist/components/atoms/buttons/IconButton.js +14 -0
  15. package/dist/components/atoms/buttons/OAuthProviderButton.d.ts +12 -0
  16. package/dist/components/atoms/buttons/OAuthProviderButton.js +143 -0
  17. package/dist/components/atoms/buttons/PendingDocuments.d.ts +10 -0
  18. package/dist/components/atoms/buttons/PendingDocuments.js +13 -0
  19. package/dist/components/atoms/buttons/PrimaryButton.d.ts +17 -0
  20. package/dist/components/atoms/buttons/PrimaryButton.js +117 -0
  21. package/dist/components/atoms/buttons/SecondaryButton.d.ts +18 -0
  22. package/dist/components/atoms/buttons/SecondaryButton.js +117 -0
  23. package/dist/components/atoms/buttons/TabNavigation.d.ts +13 -0
  24. package/dist/components/atoms/buttons/TabNavigation.js +10 -0
  25. package/dist/components/atoms/buttons/TertiaryButton.d.ts +11 -0
  26. package/dist/components/atoms/buttons/TertiaryButton.js +10 -0
  27. package/dist/components/atoms/buttons/index.d.ts +22 -0
  28. package/dist/components/atoms/buttons/index.js +11 -0
  29. package/dist/components/atoms/checkboxes/Checkbox.d.ts +14 -0
  30. package/dist/components/atoms/checkboxes/Checkbox.js +19 -0
  31. package/dist/components/atoms/checkboxes/index.d.ts +2 -0
  32. package/dist/components/atoms/checkboxes/index.js +1 -0
  33. package/dist/components/atoms/filter/Filter.d.ts +17 -0
  34. package/dist/components/atoms/filter/Filter.js +70 -0
  35. package/dist/components/atoms/filter/index.d.ts +2 -0
  36. package/dist/components/atoms/filter/index.js +1 -0
  37. package/dist/components/atoms/filters/SingleFilter.d.ts +17 -0
  38. package/dist/components/atoms/filters/SingleFilter.js +81 -0
  39. package/dist/components/atoms/filters/index.d.ts +2 -0
  40. package/dist/components/atoms/filters/index.js +1 -0
  41. package/dist/components/atoms/inputs/Input.d.ts +22 -0
  42. package/dist/components/atoms/inputs/Input.js +86 -0
  43. package/dist/components/atoms/inputs/SearchBar.d.ts +12 -0
  44. package/dist/components/atoms/inputs/SearchBar.js +20 -0
  45. package/dist/components/atoms/inputs/TextArea.d.ts +21 -0
  46. package/dist/components/atoms/inputs/TextArea.js +66 -0
  47. package/dist/components/atoms/inputs/index.d.ts +6 -0
  48. package/dist/components/atoms/inputs/index.js +3 -0
  49. package/dist/components/atoms/progressBars/ProgressBar.d.ts +15 -0
  50. package/dist/components/atoms/progressBars/ProgressBar.js +18 -0
  51. package/dist/components/atoms/progressBars/index.d.ts +2 -0
  52. package/dist/components/atoms/progressBars/index.js +1 -0
  53. package/dist/components/atoms/radios/RadioButton.d.ts +11 -0
  54. package/dist/components/atoms/radios/RadioButton.js +10 -0
  55. package/dist/components/atoms/radios/index.d.ts +2 -0
  56. package/dist/components/atoms/radios/index.js +1 -0
  57. package/dist/components/atoms/selects/ComboBox.d.ts +27 -0
  58. package/dist/components/atoms/selects/ComboBox.js +172 -0
  59. package/dist/components/atoms/selects/Select.d.ts +25 -0
  60. package/dist/components/atoms/selects/Select.js +127 -0
  61. package/dist/components/atoms/selects/index.d.ts +4 -0
  62. package/dist/components/atoms/selects/index.js +2 -0
  63. package/dist/components/atoms/tags/AppointementStatusTag.d.ts +8 -0
  64. package/dist/components/atoms/tags/AppointementStatusTag.js +42 -0
  65. package/dist/components/atoms/tags/FolderStatusTag.d.ts +7 -0
  66. package/dist/components/atoms/tags/FolderStatusTag.js +8 -0
  67. package/dist/components/atoms/tags/OtherStatusTag.d.ts +10 -0
  68. package/dist/components/atoms/tags/OtherStatusTag.js +10 -0
  69. package/dist/components/atoms/tags/index.d.ts +6 -0
  70. package/dist/components/atoms/tags/index.js +3 -0
  71. package/dist/components/atoms/typography/Heading.d.ts +10 -0
  72. package/dist/components/atoms/typography/Heading.js +7 -0
  73. package/dist/components/atoms/typography/Paragraph.d.ts +12 -0
  74. package/dist/components/atoms/typography/Paragraph.js +33 -0
  75. package/dist/components/atoms/typography/SmallTitle.d.ts +9 -0
  76. package/dist/components/atoms/typography/SmallTitle.js +7 -0
  77. package/dist/components/atoms/typography/Subtitle.d.ts +9 -0
  78. package/dist/components/atoms/typography/Subtitle.js +7 -0
  79. package/dist/components/atoms/typography/TinyInfo.d.ts +12 -0
  80. package/dist/components/atoms/typography/TinyInfo.js +15 -0
  81. package/dist/components/atoms/typography/index.d.ts +10 -0
  82. package/dist/components/atoms/typography/index.js +5 -0
  83. package/dist/components/atoms/uiVariables/BorderRadius.d.ts +6 -0
  84. package/dist/components/atoms/uiVariables/BorderRadius.js +12 -0
  85. package/dist/components/atoms/uiVariables/Shadows.d.ts +6 -0
  86. package/dist/components/atoms/uiVariables/Shadows.js +11 -0
  87. package/dist/components/atoms/uiVariables/Strokes.d.ts +6 -0
  88. package/dist/components/atoms/uiVariables/Strokes.js +10 -0
  89. package/dist/components/atoms/uiVariables/index.d.ts +3 -0
  90. package/dist/components/atoms/uiVariables/index.js +3 -0
  91. package/dist/components/molecules/appointmentSlot/AppointmentSlot.d.ts +25 -0
  92. package/dist/components/molecules/appointmentSlot/AppointmentSlot.js +109 -0
  93. package/dist/components/molecules/appointmentSlot/index.d.ts +2 -0
  94. package/dist/components/molecules/appointmentSlot/index.js +1 -0
  95. package/dist/components/molecules/breadcrumb/Breadcrumb.d.ts +12 -0
  96. package/dist/components/molecules/breadcrumb/Breadcrumb.js +12 -0
  97. package/dist/components/molecules/breadcrumb/index.d.ts +2 -0
  98. package/dist/components/molecules/breadcrumb/index.js +1 -0
  99. package/dist/components/molecules/caseCard/CaseCard.d.ts +14 -0
  100. package/dist/components/molecules/caseCard/CaseCard.js +20 -0
  101. package/dist/components/molecules/caseCard/index.d.ts +2 -0
  102. package/dist/components/molecules/caseCard/index.js +1 -0
  103. package/dist/components/molecules/caseLinkCard/CaseLinkCard.d.ts +11 -0
  104. package/dist/components/molecules/caseLinkCard/CaseLinkCard.js +30 -0
  105. package/dist/components/molecules/caseLinkCard/index.d.ts +2 -0
  106. package/dist/components/molecules/caseLinkCard/index.js +1 -0
  107. package/dist/components/molecules/checkboxForm/CheckboxForm.d.ts +17 -0
  108. package/dist/components/molecules/checkboxForm/CheckboxForm.js +24 -0
  109. package/dist/components/molecules/checkboxForm/index.d.ts +2 -0
  110. package/dist/components/molecules/checkboxForm/index.js +1 -0
  111. package/dist/components/molecules/clientLinkCard/ClientLinkCard.d.ts +13 -0
  112. package/dist/components/molecules/clientLinkCard/ClientLinkCard.js +16 -0
  113. package/dist/components/molecules/clientLinkCard/index.d.ts +2 -0
  114. package/dist/components/molecules/clientLinkCard/index.js +1 -0
  115. package/dist/components/molecules/contactCard/ContactCard.d.ts +17 -0
  116. package/dist/components/molecules/contactCard/ContactCard.js +80 -0
  117. package/dist/components/molecules/contactCard/index.d.ts +2 -0
  118. package/dist/components/molecules/contactCard/index.js +1 -0
  119. package/dist/components/molecules/documentCard/DocumentCard.d.ts +15 -0
  120. package/dist/components/molecules/documentCard/DocumentCard.js +72 -0
  121. package/dist/components/molecules/documentCard/index.d.ts +2 -0
  122. package/dist/components/molecules/documentCard/index.js +1 -0
  123. package/dist/components/molecules/employeeCard/EmployeeCard.d.ts +15 -0
  124. package/dist/components/molecules/employeeCard/EmployeeCard.js +34 -0
  125. package/dist/components/molecules/employeeCard/index.d.ts +2 -0
  126. package/dist/components/molecules/employeeCard/index.js +1 -0
  127. package/dist/components/molecules/loadingBox/LoadingBox.d.ts +9 -0
  128. package/dist/components/molecules/loadingBox/LoadingBox.js +7 -0
  129. package/dist/components/molecules/loadingBox/index.d.ts +2 -0
  130. package/dist/components/molecules/loadingBox/index.js +1 -0
  131. package/dist/components/molecules/proCard/ProCard.d.ts +13 -0
  132. package/dist/components/molecules/proCard/ProCard.js +25 -0
  133. package/dist/components/molecules/proCard/index.d.ts +2 -0
  134. package/dist/components/molecules/proCard/index.js +1 -0
  135. package/dist/components/molecules/radioForm/RadioForm.d.ts +12 -0
  136. package/dist/components/molecules/radioForm/RadioForm.js +27 -0
  137. package/dist/components/molecules/radioForm/index.d.ts +2 -0
  138. package/dist/components/molecules/radioForm/index.js +1 -0
  139. package/dist/components/molecules/selectForm/SelectForm.d.ts +15 -0
  140. package/dist/components/molecules/selectForm/SelectForm.js +15 -0
  141. package/dist/components/molecules/selectForm/index.d.ts +2 -0
  142. package/dist/components/molecules/selectForm/index.js +1 -0
  143. package/dist/components/molecules/stepper/Stepper.d.ts +34 -0
  144. package/dist/components/molecules/stepper/Stepper.js +123 -0
  145. package/dist/components/molecules/stepper/index.d.ts +2 -0
  146. package/dist/components/molecules/stepper/index.js +1 -0
  147. package/dist/index.d.ts +51 -0
  148. package/dist/index.js +71 -0
  149. package/dist/utils/regex.d.ts +5 -0
  150. package/dist/utils/regex.js +7 -0
  151. package/dist/utils/utils.d.ts +2 -0
  152. package/dist/utils/utils.js +48 -0
  153. package/package.json +1 -1
  154. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,66 @@
1
+ // TextArea.tsx
2
+ import React, { useState, useEffect, useCallback, forwardRef, useImperativeHandle, useRef, } from "react";
3
+ import "./TextArea.css";
4
+ import "../../../styles/global.css";
5
+ import { commonRegex } from "../../../utils/regex";
6
+ import TinyInfo from "../typography/TinyInfo";
7
+ import Paragraph from "../typography/Paragraph";
8
+ var TextArea = forwardRef(function (_a, ref) {
9
+ var title = _a.title, _b = _a.style, style = _b === void 0 ? "default" : _b, placeholder = _a.placeholder, _c = _a.isRequired, isRequired = _c === void 0 ? false : _c, validate = _a.validate, onError = _a.onError, onChange = _a.onChange, propValue = _a.value, propError = _a.error, _d = _a.maxHeight, maxHeight = _d === void 0 ? 400 : _d;
10
+ var _e = useState(propValue || ""), value = _e[0], setValue = _e[1];
11
+ var _f = useState(propError || ""), error = _f[0], setError = _f[1];
12
+ var _g = useState(false), isTouched = _g[0], setIsTouched = _g[1];
13
+ var textareaRef = useRef(null);
14
+ useEffect(function () {
15
+ setValue(propValue || "");
16
+ }, [propValue]);
17
+ useEffect(function () {
18
+ setError(propError || "");
19
+ }, [propError]);
20
+ var validateTextArea = useCallback(function () {
21
+ var _a;
22
+ var currentValue = ((_a = textareaRef.current) === null || _a === void 0 ? void 0 : _a.value) || value;
23
+ var errorMessage = "";
24
+ if (isRequired && currentValue.trim() === "") {
25
+ errorMessage = "Ce champ est requis";
26
+ }
27
+ else if (validate && currentValue) {
28
+ var regex = typeof validate === "string" ? commonRegex[validate] : validate;
29
+ if (!regex.test(currentValue)) {
30
+ errorMessage = "Veuillez vérifier votre saisie";
31
+ }
32
+ }
33
+ setError(errorMessage);
34
+ setIsTouched(true);
35
+ onError === null || onError === void 0 ? void 0 : onError(errorMessage);
36
+ return !errorMessage;
37
+ }, [isRequired, value, validate, onError]);
38
+ useImperativeHandle(ref, function () { return ({
39
+ validate: validateTextArea,
40
+ }); });
41
+ var handleChange = function (e) {
42
+ var newValue = e.target.value;
43
+ setValue(newValue);
44
+ onChange === null || onChange === void 0 ? void 0 : onChange(e);
45
+ if (isTouched) {
46
+ validateTextArea();
47
+ }
48
+ };
49
+ var handleBlur = function () {
50
+ setIsTouched(true);
51
+ validateTextArea();
52
+ };
53
+ return (React.createElement("div", { className: "TextArea text-area-".concat(style) },
54
+ React.createElement("div", { className: "text-area-title-container" },
55
+ React.createElement(Paragraph, { variant: "semiBold", color: "noir", text: title }),
56
+ isRequired && title && (React.createElement("span", { className: "text-area-required" },
57
+ "\u00A0",
58
+ "*"))),
59
+ React.createElement("div", { className: "text-area-container" },
60
+ React.createElement("div", { className: "text-area-input" },
61
+ React.createElement("textarea", { ref: textareaRef, placeholder: placeholder, className: "text-area-placeholder", value: value, onChange: handleChange, onBlur: handleBlur, style: { maxHeight: "".concat(maxHeight, "px") } })),
62
+ error && isTouched && (React.createElement("div", { className: "error-message" },
63
+ React.createElement(TinyInfo, { variant: "medium12", color: "actions-error", text: error }))))));
64
+ });
65
+ TextArea.displayName = "TextArea";
66
+ export default TextArea;
@@ -0,0 +1,6 @@
1
+ export { default as Input } from "./Input";
2
+ export { default as TextArea } from "./TextArea";
3
+ export { default as SearchBar } from "./SearchBar";
4
+ export type { InputProps, InputRef } from "./Input";
5
+ export type { SearchBarProps } from "./SearchBar";
6
+ export type { TextAreaProps, TextAreaRef } from "./TextArea";
@@ -0,0 +1,3 @@
1
+ export { default as Input } from "./Input";
2
+ export { default as TextArea } from "./TextArea";
3
+ export { default as SearchBar } from "./SearchBar";
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ import "./ProgressBar.css";
3
+ import "../../../styles/global.css";
4
+ import "../../../styles/icons.css";
5
+ export interface ProgressBarProps {
6
+ steps: number;
7
+ currentStep: number;
8
+ startIcon?: boolean;
9
+ endIcon?: boolean;
10
+ onStartIconClick?: () => void;
11
+ onEndIconClick?: () => void;
12
+ showProgressBar?: boolean;
13
+ }
14
+ declare const ProgressBar: React.FC<ProgressBarProps>;
15
+ export default ProgressBar;
@@ -0,0 +1,18 @@
1
+ import React from "react";
2
+ import "./ProgressBar.css";
3
+ import "../../../styles/global.css";
4
+ import "../../../styles/icons.css";
5
+ var ProgressBar = function (_a) {
6
+ var steps = _a.steps, currentStep = _a.currentStep, _b = _a.startIcon, startIcon = _b === void 0 ? true : _b, _c = _a.endIcon, endIcon = _c === void 0 ? true : _c, onStartIconClick = _a.onStartIconClick, onEndIconClick = _a.onEndIconClick, _d = _a.showProgressBar, showProgressBar = _d === void 0 ? true : _d;
7
+ var constrainedCurrentStep = Math.max(0, Math.min(currentStep, steps));
8
+ var progressWidth = constrainedCurrentStep === 0 ? 0 : (constrainedCurrentStep / steps) * 100;
9
+ return (React.createElement("div", { className: "progress-bar-container" },
10
+ startIcon && currentStep > 1 ? (React.createElement("div", { className: "progress-bar-icon-container" },
11
+ React.createElement("button", { className: "progress-bar-chevron", onClick: onStartIconClick },
12
+ React.createElement("i", { className: "allaw-icon-chevron-left" })))) : React.createElement("div", { style: { minWidth: "32px" } }),
13
+ React.createElement("div", { className: "progress-bar-background ".concat(showProgressBar ? "" : "hidden-content") },
14
+ React.createElement("div", { className: "progress-bar-fill", style: { width: "".concat(progressWidth, "%") } })),
15
+ endIcon && (React.createElement("button", { className: "progress-bar-close", onClick: onEndIconClick },
16
+ React.createElement("i", { className: "allaw-icon-close" })))));
17
+ };
18
+ export default ProgressBar;
@@ -0,0 +1,2 @@
1
+ export { default as ProgressBar } from "./ProgressBar";
2
+ export type { ProgressBarProps } from "./ProgressBar";
@@ -0,0 +1 @@
1
+ export { default as ProgressBar } from "./ProgressBar";
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import "./RadioButton.css";
3
+ import "../../../styles/global.css";
4
+ export interface RadioButtonProps {
5
+ label: string;
6
+ style?: "user" | "hybride";
7
+ isActive: boolean;
8
+ onClick: () => void;
9
+ }
10
+ declare const RadioButton: React.FC<RadioButtonProps>;
11
+ export default RadioButton;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import "./RadioButton.css";
3
+ import "../../../styles/global.css";
4
+ var RadioButton = function (_a) {
5
+ var label = _a.label, _b = _a.style, style = _b === void 0 ? "user" : _b, isActive = _a.isActive, onClick = _a.onClick;
6
+ return (React.createElement("button", { className: "radio-button radio-button-".concat(style, " ").concat(isActive ? "radio-button-".concat(style, "-active") : ""), onClick: onClick },
7
+ React.createElement("span", { className: "radio-button-icon" }, isActive && React.createElement("span", { className: "radio-button-icon-inner" })),
8
+ React.createElement("span", { className: "radio-button-label" }, label)));
9
+ };
10
+ export default RadioButton;
@@ -0,0 +1,2 @@
1
+ export { default as RadioButton } from "./RadioButton";
2
+ export type { RadioButtonProps } from "./RadioButton";
@@ -0,0 +1 @@
1
+ export { default as RadioButton } from "./RadioButton";
@@ -0,0 +1,27 @@
1
+ import React from "react";
2
+ import "./ComboBox.css";
3
+ import "../../../styles/global.css";
4
+ export interface SelectItem {
5
+ label: string;
6
+ value: string;
7
+ }
8
+ export interface ComboBoxProps {
9
+ items: SelectItem[];
10
+ selectedItem?: string;
11
+ placeholder?: string;
12
+ isRequired?: boolean;
13
+ showError?: boolean;
14
+ width?: number;
15
+ onSelect?: (selected: string) => void;
16
+ onChange?: (value: string) => void;
17
+ onError?: (error: string) => void;
18
+ openOnMount?: boolean;
19
+ title?: string;
20
+ }
21
+ export interface ComboBoxRef {
22
+ validate: () => boolean;
23
+ }
24
+ declare const _default: (props: ComboBoxProps & {
25
+ ref?: React.Ref<ComboBoxRef>;
26
+ }) => React.ReactElement;
27
+ export default _default;
@@ -0,0 +1,172 @@
1
+ import React, { useState, useEffect, useRef, useImperativeHandle, forwardRef, } from "react";
2
+ import "./ComboBox.css";
3
+ import "../../../styles/global.css";
4
+ import TinyInfo from "../typography/TinyInfo";
5
+ import Paragraph from "../typography/Paragraph";
6
+ import { createPortal } from "react-dom";
7
+ function ComboBox(_a, ref) {
8
+ var items = _a.items, selectedItem = _a.selectedItem, _b = _a.placeholder, placeholder = _b === void 0 ? "Sélectionner..." : _b, _c = _a.isRequired, isRequired = _c === void 0 ? false : _c, _d = _a.showError, showError = _d === void 0 ? false : _d, _e = _a.width, width = _e === void 0 ? 100 : _e, onSelect = _a.onSelect, onChange = _a.onChange, onError = _a.onError, _f = _a.openOnMount, openOnMount = _f === void 0 ? true : _f, title = _a.title;
9
+ var _g = useState(openOnMount), isOpen = _g[0], setIsOpen = _g[1];
10
+ var _h = useState(""), inputValue = _h[0], setInputValue = _h[1];
11
+ var _j = useState(items), filteredItems = _j[0], setFilteredItems = _j[1];
12
+ var _k = useState(""), error = _k[0], setError = _k[1];
13
+ var _l = useState(false), isHovered = _l[0], setIsHovered = _l[1];
14
+ var _m = useState(-1), selectedIndex = _m[0], setSelectedIndex = _m[1];
15
+ var comboBoxRef = useRef(null);
16
+ var inputContainerRef = useRef(null);
17
+ var listRef = useRef(null);
18
+ var inputRef = useRef(null);
19
+ var chevronRef = useRef(null);
20
+ var _o = useState(true), isInputValid = _o[0], setIsInputValid = _o[1];
21
+ var _p = useState({
22
+ top: 0,
23
+ left: 0,
24
+ width: 0,
25
+ }), listPosition = _p[0], setListPosition = _p[1];
26
+ useEffect(function () {
27
+ if (selectedItem) {
28
+ var selectedItemData = items.find(function (item) { return item.value === selectedItem; });
29
+ setInputValue(selectedItemData ? selectedItemData.label : "");
30
+ }
31
+ else {
32
+ setInputValue("");
33
+ }
34
+ setFilteredItems(items);
35
+ }, [selectedItem, items]);
36
+ useEffect(function () {
37
+ var handleClickOutside = function (event) {
38
+ if (inputContainerRef.current &&
39
+ !inputContainerRef.current.contains(event.target) &&
40
+ listRef.current &&
41
+ !listRef.current.contains(event.target)) {
42
+ setIsOpen(false);
43
+ }
44
+ };
45
+ document.addEventListener("mousedown", handleClickOutside);
46
+ return function () {
47
+ document.removeEventListener("mousedown", handleClickOutside);
48
+ };
49
+ }, []);
50
+ useEffect(function () {
51
+ if (isOpen && inputContainerRef.current) {
52
+ var rect = inputContainerRef.current.getBoundingClientRect();
53
+ setListPosition({
54
+ top: rect.bottom + window.scrollY,
55
+ left: rect.left + window.scrollX,
56
+ width: rect.width,
57
+ });
58
+ }
59
+ }, [isOpen]);
60
+ var handleInputChange = function (event) {
61
+ var value = event.target.value;
62
+ setInputValue(value);
63
+ var filtered = items.filter(function (item) {
64
+ return item.label.toLowerCase().includes(value.toLowerCase());
65
+ });
66
+ setFilteredItems(filtered);
67
+ setIsInputValid(filtered.length > 0 || value === "");
68
+ setIsOpen(true);
69
+ onChange === null || onChange === void 0 ? void 0 : onChange(value);
70
+ };
71
+ var handleInputFocus = function () {
72
+ setIsOpen(true);
73
+ };
74
+ var handleSelect = function (item, index) {
75
+ // console.log("Élément sélectionné :", item);
76
+ setInputValue(item.label);
77
+ setSelectedIndex(index);
78
+ setFilteredItems(items);
79
+ setIsOpen(false);
80
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect(item.value);
81
+ validateSelect(item.value);
82
+ };
83
+ var validateSelect = function (value) {
84
+ var isEmpty = value === "";
85
+ var errorMessage = isRequired && isEmpty ? "Ce champ est requis" : "";
86
+ // console.log("Validation de la sélection :", errorMessage);
87
+ setError(errorMessage);
88
+ onError === null || onError === void 0 ? void 0 : onError(errorMessage);
89
+ return !errorMessage;
90
+ };
91
+ useImperativeHandle(ref, function () { return ({
92
+ validate: function () { return validateSelect(inputValue); },
93
+ }); });
94
+ var handleChevronClick = function () {
95
+ if (!isInputValid) {
96
+ setInputValue("");
97
+ setFilteredItems(items);
98
+ setIsInputValid(true);
99
+ }
100
+ else {
101
+ setIsOpen(!isOpen);
102
+ }
103
+ };
104
+ var handleMouseEnter = function () {
105
+ setIsHovered(true);
106
+ };
107
+ var handleMouseLeave = function () {
108
+ setIsHovered(false);
109
+ };
110
+ var handleItemClick = function (item, index) {
111
+ // console.log("Clic sur l'élément :", item);
112
+ handleSelect(item, index);
113
+ };
114
+ var handleKeyDown = function (event) {
115
+ if (isOpen) {
116
+ switch (event.key) {
117
+ case "ArrowUp":
118
+ event.preventDefault();
119
+ setSelectedIndex(function (prevIndex) {
120
+ return prevIndex <= 0 ? filteredItems.length - 1 : prevIndex - 1;
121
+ });
122
+ break;
123
+ case "ArrowDown":
124
+ event.preventDefault();
125
+ setSelectedIndex(function (prevIndex) {
126
+ return prevIndex >= filteredItems.length - 1 ? 0 : prevIndex + 1;
127
+ });
128
+ break;
129
+ case "Enter":
130
+ event.preventDefault();
131
+ if (selectedIndex !== -1) {
132
+ handleSelect(filteredItems[selectedIndex], selectedIndex);
133
+ }
134
+ break;
135
+ default:
136
+ break;
137
+ }
138
+ }
139
+ };
140
+ useEffect(function () {
141
+ var handleKeyDownWrapper = function (event) {
142
+ if (inputRef.current && event.target === inputRef.current) {
143
+ handleKeyDown(event);
144
+ }
145
+ };
146
+ document.addEventListener("keydown", handleKeyDownWrapper);
147
+ return function () {
148
+ document.removeEventListener("keydown", handleKeyDownWrapper);
149
+ };
150
+ }, [isOpen, filteredItems, selectedIndex]);
151
+ return (React.createElement("div", { ref: comboBoxRef, className: "combo-box-container ".concat(isOpen ? "combo-box-pressed" : "", " ").concat(isHovered ? "combo-box-hovered" : ""), style: { width: "".concat(width, "%") }, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave },
152
+ title && (React.createElement("div", { className: "combo-box-title-container" },
153
+ React.createElement(Paragraph, { variant: "semiBold", color: "noir", text: title }),
154
+ isRequired && (React.createElement("span", { className: "combo-box-required" },
155
+ "\u00A0",
156
+ "*")))),
157
+ React.createElement("div", { ref: inputContainerRef, className: "combo-box-input-container" },
158
+ React.createElement("input", { ref: inputRef, className: "combo-box ".concat(isOpen ? "combo-box-pressed" : "combo-box-default", " ").concat(isHovered ? "combo-box-hovered" : ""), placeholder: placeholder, value: inputValue, onChange: handleInputChange, onFocus: handleInputFocus, style: { width: "100%" } }),
159
+ React.createElement("div", { ref: chevronRef, className: "combo-box-chevron ".concat(isHovered ? "combo-box-hovered" : ""), onClick: handleChevronClick },
160
+ React.createElement("i", { className: "allaw-icon-".concat(isInputValid ? "chevron-down" : "close") }))),
161
+ isOpen &&
162
+ filteredItems.length > 0 &&
163
+ createPortal(React.createElement("div", { ref: listRef, className: "combo-box-list", style: {
164
+ top: "".concat(listPosition.top, "px"),
165
+ left: "".concat(listPosition.left, "px"),
166
+ width: "".concat(listPosition.width, "px"),
167
+ } }, filteredItems.map(function (item, index) { return (React.createElement("div", { key: item.value, "data-value": item.value, className: "combo-box-item ".concat(index === selectedIndex ? "highlighted" : ""), onClick: function () { return handleItemClick(item, index); } },
168
+ React.createElement("span", { className: "combo-box-item-text" }, item.label))); })), document.body),
169
+ isRequired && showError && error && (React.createElement("div", { className: "error-message" },
170
+ React.createElement(TinyInfo, { variant: "medium12", color: "actions-error", text: error })))));
171
+ }
172
+ export default forwardRef(ComboBox);
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import "./Select.css";
3
+ import "../../../styles/global.css";
4
+ export interface SelectItem {
5
+ label: string;
6
+ value: string;
7
+ }
8
+ export interface SelectProps<T extends string | string[]> {
9
+ items: SelectItem[];
10
+ selectedItem?: T;
11
+ placeholder?: string;
12
+ multiple?: boolean;
13
+ isRequired?: boolean;
14
+ showError?: boolean;
15
+ width?: number;
16
+ onChange?: (selected: T) => void;
17
+ onError?: (error: string) => void;
18
+ }
19
+ export interface SelectRef {
20
+ validate: () => boolean;
21
+ }
22
+ declare const _default: <T extends string | string[]>(props: SelectProps<T> & {
23
+ ref?: React.Ref<SelectRef>;
24
+ }) => React.ReactElement;
25
+ export default _default;
@@ -0,0 +1,127 @@
1
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
+ if (ar || !(i in from)) {
4
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
5
+ ar[i] = from[i];
6
+ }
7
+ }
8
+ return to.concat(ar || Array.prototype.slice.call(from));
9
+ };
10
+ import React, { useState, useEffect, useRef, useImperativeHandle, forwardRef, } from "react";
11
+ import ReactDOM from "react-dom";
12
+ import "./Select.css";
13
+ import "../../../styles/global.css";
14
+ import TinyInfo from "../typography/TinyInfo";
15
+ function Select(_a, ref) {
16
+ var _b;
17
+ var items = _a.items, selectedItem = _a.selectedItem, _c = _a.placeholder, placeholder = _c === void 0 ? "Select..." : _c, _d = _a.multiple, multiple = _d === void 0 ? false : _d, _e = _a.isRequired, isRequired = _e === void 0 ? false : _e, _f = _a.showError, showError = _f === void 0 ? false : _f, _g = _a.width, width = _g === void 0 ? 100 : _g, onChange = _a.onChange, onError = _a.onError;
18
+ var _h = useState(false), isOpen = _h[0], setIsOpen = _h[1];
19
+ var _j = useState((multiple ? selectedItem || [] : selectedItem || "")), selected = _j[0], setSelected = _j[1];
20
+ var _k = useState(""), error = _k[0], setError = _k[1];
21
+ var selectRef = useRef(null);
22
+ var listRef = useRef(null);
23
+ var _l = useState({
24
+ top: 0,
25
+ left: 0,
26
+ width: 0,
27
+ }), listPosition = _l[0], setListPosition = _l[1];
28
+ useEffect(function () {
29
+ setSelected((multiple ? selectedItem || [] : selectedItem || ""));
30
+ }, [selectedItem, multiple]);
31
+ useEffect(function () {
32
+ if (!multiple && selectedItem && isOpen && listRef.current) {
33
+ var selectedItemElement = listRef.current.querySelector(".select-item[data-value=\"".concat(selectedItem, "\"]"));
34
+ if (selectedItemElement instanceof HTMLElement) {
35
+ var listHeight = listRef.current.offsetHeight;
36
+ var itemHeight = selectedItemElement.offsetHeight;
37
+ var scrollTop = selectedItemElement.offsetTop - listHeight / 2 + itemHeight / 2;
38
+ listRef.current.scrollTop = scrollTop;
39
+ }
40
+ }
41
+ }, [isOpen, multiple, selectedItem]);
42
+ var handleSelect = function (item) {
43
+ var newSelected;
44
+ if (multiple) {
45
+ newSelected = (Array.isArray(selected)
46
+ ? selected.includes(item.value)
47
+ ? selected.filter(function (i) { return i !== item.value; })
48
+ : __spreadArray(__spreadArray([], selected, true), [item.value], false)
49
+ : [item.value]);
50
+ }
51
+ else {
52
+ newSelected = item.value;
53
+ setIsOpen(false);
54
+ }
55
+ setSelected(newSelected);
56
+ onChange === null || onChange === void 0 ? void 0 : onChange(newSelected);
57
+ validateSelect(newSelected);
58
+ };
59
+ var validateSelect = function (value) {
60
+ var isEmpty = value === "" || (Array.isArray(value) && value.length === 0);
61
+ var errorMessage = isRequired && isEmpty ? "Ce champ est requis" : "";
62
+ setError(errorMessage);
63
+ onError === null || onError === void 0 ? void 0 : onError(errorMessage);
64
+ return !errorMessage;
65
+ };
66
+ var updateListPosition = function () {
67
+ if (selectRef.current) {
68
+ var rect = selectRef.current.getBoundingClientRect();
69
+ setListPosition({
70
+ top: rect.bottom + window.scrollY,
71
+ left: rect.left + window.scrollX,
72
+ width: rect.width,
73
+ });
74
+ }
75
+ };
76
+ var toggleOpen = function () {
77
+ if (!isOpen) {
78
+ updateListPosition();
79
+ }
80
+ setIsOpen(!isOpen);
81
+ };
82
+ var handleClickOutside = function (event) {
83
+ if (selectRef.current &&
84
+ !selectRef.current.contains(event.target) &&
85
+ listRef.current &&
86
+ !listRef.current.contains(event.target)) {
87
+ setIsOpen(false);
88
+ }
89
+ };
90
+ useEffect(function () {
91
+ if (isOpen) {
92
+ document.addEventListener("mousedown", handleClickOutside);
93
+ }
94
+ else {
95
+ document.removeEventListener("mousedown", handleClickOutside);
96
+ }
97
+ return function () {
98
+ document.removeEventListener("mousedown", handleClickOutside);
99
+ };
100
+ }, [isOpen]);
101
+ var renderList = function () { return (React.createElement("div", { ref: listRef, className: "select-list ".concat(isOpen ? "visible" : ""), style: {
102
+ top: "".concat(listPosition.top, "px"),
103
+ left: "".concat(listPosition.left, "px"),
104
+ width: "".concat(listPosition.width, "px"),
105
+ } }, items.map(function (item) { return (React.createElement("div", { key: item.value, "data-value": item.value, className: "select-item ".concat(Array.isArray(selected) && selected.includes(item.value)
106
+ ? "selected"
107
+ : "", " ").concat(!multiple && item.value === selectedItem ? "highlighted" : "", " ").concat(!multiple ? "single-select" : ""), onClick: function () { return handleSelect(item); } },
108
+ multiple && React.createElement("span", { className: "select-item-icon allaw-icon-check" }),
109
+ React.createElement("span", { className: "select-item-text" }, item.label))); }))); };
110
+ useImperativeHandle(ref, function () { return ({
111
+ validate: function () { return validateSelect(selected); },
112
+ }); });
113
+ return (React.createElement("div", { ref: selectRef, className: "select-container ".concat(isOpen ? "select-pressed" : ""), style: { width: "".concat(width, "%") } },
114
+ React.createElement("button", { type: "button", className: "select ".concat(isOpen ? "select-pressed" : "select-default"), onClick: toggleOpen, style: { width: "100%" } },
115
+ React.createElement("span", { className: "select-text" }, Array.isArray(selected) && selected.length > 0
116
+ ? selected
117
+ .map(function (val) { var _a; return (_a = items.find(function (item) { return item.value === val; })) === null || _a === void 0 ? void 0 : _a.label; })
118
+ .join(", ")
119
+ : !Array.isArray(selected) && selected
120
+ ? (_b = items.find(function (item) { return item.value === selected; })) === null || _b === void 0 ? void 0 : _b.label
121
+ : placeholder),
122
+ React.createElement("span", { className: "select-icon ".concat(isOpen ? "allaw-icon-chevron-up" : "allaw-icon-chevron-down") })),
123
+ isOpen && ReactDOM.createPortal(renderList(), document.body),
124
+ isRequired && showError && error && (React.createElement("div", { className: "error-message" },
125
+ React.createElement(TinyInfo, { variant: "medium12", color: "actions-error", text: error })))));
126
+ }
127
+ export default forwardRef(Select);
@@ -0,0 +1,4 @@
1
+ export { default as Select } from "./Select";
2
+ export type { SelectItem, SelectProps, SelectRef } from "./Select";
3
+ export { default as ComboBox } from "./ComboBox";
4
+ export type { ComboBoxProps, ComboBoxRef } from "./ComboBox";
@@ -0,0 +1,2 @@
1
+ export { default as Select } from "./Select";
2
+ export { default as ComboBox } from "./ComboBox";
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import "./AppointementStatusTag.css";
3
+ export interface AppointementStatusTagProps {
4
+ status: "confirmed" | "pending" | "available" | "unavailable" | "cancelled" | "passed" | "refused";
5
+ variant?: "default" | "big" | "small";
6
+ }
7
+ declare const AppointementStatusTag: ({ status, variant, }: AppointementStatusTagProps) => React.JSX.Element;
8
+ export default AppointementStatusTag;
@@ -0,0 +1,42 @@
1
+ import React from "react";
2
+ import "./AppointementStatusTag.css";
3
+ var statusStyles = {
4
+ confirmed: "status-confirmed",
5
+ pending: "status-pending",
6
+ available: "status-available",
7
+ unavailable: "status-unavailable",
8
+ cancelled: "status-cancelled",
9
+ passed: "status-passed",
10
+ refused: "status-refused",
11
+ };
12
+ var statusLabels = {
13
+ confirmed: "CONFIRMÉ",
14
+ pending: "EN ATTENTE",
15
+ available: "DISPONIBLE",
16
+ unavailable: "INDISPONIBLE",
17
+ cancelled: "ANNULÉ",
18
+ passed: "PASSÉ",
19
+ refused: "REFUSÉ",
20
+ };
21
+ var variantLabels = {
22
+ confirmed: "RDV CONFIRMÉ",
23
+ passed: "RDV PASSÉ",
24
+ cancelled: "RDV ANNULÉ",
25
+ };
26
+ var variantStyles = {
27
+ small: "variant-small",
28
+ big: "variant-big",
29
+ default: "variant-default",
30
+ };
31
+ var AppointementStatusTag = function (_a) {
32
+ var status = _a.status, _b = _a.variant, variant = _b === void 0 ? "default" : _b;
33
+ var label = variant === "big" && variantLabels[status]
34
+ ? variantLabels[status]
35
+ : statusLabels[status];
36
+ var variantClass = variantStyles[variant];
37
+ var specificStyles = status === "cancelled" && variant === "big"
38
+ ? "status-cancelled-big"
39
+ : statusStyles[status];
40
+ return (React.createElement("span", { className: "appointement-status-tag ".concat(variantClass, " ").concat(specificStyles) }, label));
41
+ };
42
+ export default AppointementStatusTag;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import "./FolderStatusTag.css";
3
+ export interface FolderStatusTagProps {
4
+ isClosed?: boolean;
5
+ }
6
+ declare const FolderStatusTag: React.FC<FolderStatusTagProps>;
7
+ export default FolderStatusTag;
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import "./FolderStatusTag.css";
3
+ var FolderStatusTag = function (_a) {
4
+ var _b = _a.isClosed, isClosed = _b === void 0 ? false : _b;
5
+ var label = isClosed ? "DOSSIER CLÔS" : "DOSSIER OUVERT";
6
+ return (React.createElement("div", { className: "folder-status-tag ".concat(isClosed ? "closed" : "open") }, label));
7
+ };
8
+ export default FolderStatusTag;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import "./OtherStatusTag.css";
3
+ export interface OtherStatusTagProps {
4
+ label?: string;
5
+ type?: "readonly" | "editable" | "information";
6
+ startIcon?: boolean;
7
+ startIconName?: string;
8
+ }
9
+ declare const OtherStatusTag: React.FC<OtherStatusTagProps>;
10
+ export default OtherStatusTag;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import "./OtherStatusTag.css";
3
+ var OtherStatusTag = function (_a) {
4
+ var _b = _a.label, label = _b === void 0 ? "Tags" : _b, _c = _a.type, type = _c === void 0 ? "readonly" : _c, _d = _a.startIcon, startIcon = _d === void 0 ? false : _d, _e = _a.startIconName, startIconName = _e === void 0 ? "allaw-icon-pmr" : _e;
5
+ return (React.createElement("div", { className: "other-status-tag ".concat(type) },
6
+ type === "information" && startIcon && (React.createElement("span", { className: "icon ".concat(startIconName) })),
7
+ label,
8
+ type === "editable" && React.createElement("span", { className: "icon allaw-icon-close" })));
9
+ };
10
+ export default OtherStatusTag;
@@ -0,0 +1,6 @@
1
+ export { default as AppointementStatusTag } from "./AppointementStatusTag";
2
+ export { default as FolderStatusTag } from "./FolderStatusTag";
3
+ export { default as OtherStatusTag } from "./OtherStatusTag";
4
+ export type { AppointementStatusTagProps } from "./AppointementStatusTag";
5
+ export type { FolderStatusTagProps } from "./FolderStatusTag";
6
+ export type { OtherStatusTagProps } from "./OtherStatusTag";
@@ -0,0 +1,3 @@
1
+ export { default as AppointementStatusTag } from "./AppointementStatusTag";
2
+ export { default as FolderStatusTag } from "./FolderStatusTag";
3
+ export { default as OtherStatusTag } from "./OtherStatusTag";
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import "./Heading.css";
3
+ export interface HeadingProps {
4
+ variant: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "h7";
5
+ color?: "bleu-allaw" | "mid-grey" | "dark-grey" | "noir" | "pure-white";
6
+ text: React.ReactNode;
7
+ align?: "left" | "justify" | "center";
8
+ }
9
+ declare const Heading: React.FC<HeadingProps>;
10
+ export default Heading;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import "./Heading.css";
3
+ var Heading = function (_a) {
4
+ var variant = _a.variant, _b = _a.color, color = _b === void 0 ? "pure-white" : _b, text = _a.text, _c = _a.align, align = _c === void 0 ? "center" : _c;
5
+ return React.createElement("span", { className: "heading ".concat(variant, " color-").concat(color, " align-").concat(align) }, text);
6
+ };
7
+ export default Heading;