allaw-ui 1.0.30 → 1.0.32

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.
@@ -15,16 +15,16 @@
15
15
  cursor: pointer;
16
16
  transition:
17
17
  background-color 0.05s ease,
18
- transform 0.2s ease;
18
+ transform 0.1s ease;
19
19
  user-select: none;
20
20
  }
21
21
 
22
22
  .appointment-slot:hover {
23
- transform: scale(1.008);
23
+ transform: scale(1.015);
24
24
  }
25
25
 
26
26
  .appointment-slot.active {
27
- background: var(--active-grey, #e9eef5);
27
+ background: var(--grey-light-2);
28
28
  }
29
29
 
30
30
  /* Status-specific styles */
@@ -0,0 +1,20 @@
1
+ .billing-button-wrapper {
2
+ padding: 0.5rem 1rem;
3
+ background-color: #F4F7FB;
4
+ border: 1px solid var(--primary-venom-grey, #E6EDF5);
5
+ border-radius: 5px;
6
+ font-family: Inter;
7
+ display: flex;
8
+ flex-direction: row-reverse;
9
+ gap: 0.5rem;
10
+ font-weight: 600;
11
+ color: black;
12
+ align-items: center;
13
+ cursor: pointer;
14
+ }
15
+
16
+ .billing-button-wrapper > i {
17
+ color: #25BEEB;
18
+ font-weight: 500;
19
+ font-size: 16px;
20
+ }
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import "./BillingCount.css";
3
+ export type BillingCountProps = {
4
+ onEnd: (time: number) => void;
5
+ setIsStarted?: (value: boolean) => void;
6
+ };
7
+ declare function BillingCount({ onEnd, setIsStarted }: BillingCountProps): React.JSX.Element;
8
+ export default BillingCount;
@@ -0,0 +1,72 @@
1
+ import React, { useEffect, useState } from "react";
2
+ import { differenceInSeconds } from "date-fns";
3
+ import "./BillingCount.css";
4
+ function BillingCount(_a) {
5
+ var onEnd = _a.onEnd, setIsStarted = _a.setIsStarted;
6
+ var _b = useState(false), started = _b[0], setStarted = _b[1];
7
+ var _c = useState(0), time = _c[0], setTime = _c[1];
8
+ // Load saved start time and elapsed time from localStorage on component mount
9
+ useEffect(function () {
10
+ var savedStartTime = localStorage.getItem("startTimeBilling");
11
+ var savedElapsedTime = parseInt(localStorage.getItem("elapsedTime") || "0", 10);
12
+ if (savedStartTime) {
13
+ var elapsed = differenceInSeconds(new Date(), new Date(savedStartTime)) + savedElapsedTime;
14
+ setTime(elapsed);
15
+ setStarted(true);
16
+ }
17
+ else {
18
+ setTime(savedElapsedTime);
19
+ }
20
+ }, []);
21
+ // Update the timer every second if started
22
+ useEffect(function () {
23
+ var interval;
24
+ if (started) {
25
+ interval = setInterval(function () {
26
+ var savedStartTime = localStorage.getItem("startTimeBilling");
27
+ if (savedStartTime) {
28
+ var elapsed = differenceInSeconds(new Date(), new Date(savedStartTime)) + parseInt(localStorage.getItem("elapsedTime") || "0", 10);
29
+ setTime(elapsed);
30
+ }
31
+ }, 1000); // Update every second
32
+ }
33
+ return function () { return clearInterval(interval); };
34
+ }, [started]);
35
+ var handleButtonClick = function () {
36
+ if (started) {
37
+ // Stop timer and reset
38
+ setIsStarted && setIsStarted(false);
39
+ var savedStartTime = localStorage.getItem("startTimeBilling");
40
+ if (savedStartTime) {
41
+ var finalElapsedTime = differenceInSeconds(new Date(), new Date(savedStartTime)) + parseInt(localStorage.getItem("elapsedTime") || "0", 10);
42
+ onEnd(finalElapsedTime); // Callback with final time
43
+ }
44
+ localStorage.removeItem("startTimeBilling");
45
+ localStorage.removeItem("elapsedTime");
46
+ setTime(0);
47
+ setStarted(false);
48
+ }
49
+ else {
50
+ // Start timer from 0
51
+ setIsStarted && setIsStarted(true);
52
+ localStorage.setItem("startTimeBilling", new Date().toISOString());
53
+ setStarted(true);
54
+ }
55
+ };
56
+ // Format the time in hours, minutes, and seconds
57
+ var formatTime = function (seconds) {
58
+ var hrs = Math.floor(seconds / 3600);
59
+ var mins = Math.floor((seconds % 3600) / 60);
60
+ var secs = seconds % 60;
61
+ return "".concat(hrs.toString().padStart(2, "0"), ":").concat(mins.toString().padStart(2, "0"), ":").concat(secs.toString().padStart(2, "0"));
62
+ };
63
+ return React.createElement("button", { onClick: handleButtonClick, className: "billing-button-wrapper" },
64
+ React.createElement("i", { className: "allaw-icon-clock" }),
65
+ formatTime(time));
66
+ }
67
+ export default BillingCount;
68
+ /*
69
+ <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 48 48">
70
+ <path fill="#25BEEB" d="M12 39c-.549 0-1.095-.15-1.578-.447A3.008 3.008 0 0 1 9 36V12c0-1.041.54-2.007 1.422-2.553a3.014 3.014 0 0 1 2.919-.132l24 12a3.003 3.003 0 0 1 0 5.37l-24 12c-.42.21-.885.315-1.341.315z"/>
71
+ </svg>
72
+ */
@@ -0,0 +1,2 @@
1
+ export { default as BillingCount } from "./BillingCount";
2
+ export type { BillingCountProps } from "./BillingCount";
@@ -0,0 +1 @@
1
+ export { default as BillingCount } from "./BillingCount";
@@ -25,6 +25,7 @@ export interface StepperProps {
25
25
  startIconName?: string;
26
26
  endIconName?: string;
27
27
  onPrimaryButtonClick?: (step: number) => void;
28
+ disabled?: boolean;
28
29
  }[];
29
30
  showProgressBar?: boolean[];
30
31
  onClose?: () => void;
@@ -115,7 +115,7 @@ var Stepper = function (_a) {
115
115
  (currentSecondaryButton === null || currentSecondaryButton === void 0 ? void 0 : currentSecondaryButton.show) && (React.createElement("div", { className: "stepper-button-container secondary-button-container" },
116
116
  React.createElement(SecondaryButton, { fullWidth: true, 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); } }))),
117
117
  (currentPrimaryButton === null || currentPrimaryButton === void 0 ? void 0 : currentPrimaryButton.show) && (React.createElement("div", { className: "stepper-button-container primary-button-container" },
118
- React.createElement(PrimaryButton, { fullWidth: true, label: currentPrimaryButton.label, startIcon: currentPrimaryButton.startIconName ? true : undefined, endIcon: currentPrimaryButton.endIconName ? true : undefined, startIconName: currentPrimaryButton.startIconName, endIconName: currentPrimaryButton.endIconName, onClick: handleNext })))))));
118
+ React.createElement(PrimaryButton, { fullWidth: true, label: currentPrimaryButton.label, startIcon: currentPrimaryButton.startIconName ? true : undefined, endIcon: currentPrimaryButton.endIconName ? true : undefined, startIconName: currentPrimaryButton.startIconName, endIconName: currentPrimaryButton.endIconName, disabled: currentPrimaryButton.disabled, onClick: handleNext })))))));
119
119
  return portalContainerRef.current && isVisible
120
120
  ? ReactDOM.createPortal(stepperContent, portalContainerRef.current)
121
121
  : null;
package/dist/index.d.ts CHANGED
@@ -39,6 +39,7 @@ export { default as BorderRadius } from "./components/atoms/uiVariables/BorderRa
39
39
  export { default as Shadows } from "./components/atoms/uiVariables/Shadows";
40
40
  export { default as Strokes } from "./components/atoms/uiVariables/Strokes";
41
41
  export { default as AppointmentSlot } from "./components/molecules/appointmentSlot/AppointmentSlot";
42
+ export { default as BillingCount } from "./components/molecules/billingCount/BillingCount";
42
43
  export { default as CaseCard } from "./components/molecules/caseCard/CaseCard";
43
44
  export { default as ContactCard } from "./components/molecules/contactCard/ContactCard";
44
45
  export { default as CaseCardLink } from "./components/molecules/caseLinkCard/CaseLinkCard";
package/dist/index.js CHANGED
@@ -48,6 +48,7 @@ export { default as Strokes } from "./components/atoms/uiVariables/Strokes";
48
48
  // Molecules
49
49
  // Appointment Slot
50
50
  export { default as AppointmentSlot } from "./components/molecules/appointmentSlot/AppointmentSlot";
51
+ export { default as BillingCount } from "./components/molecules/billingCount/BillingCount";
51
52
  // Case Card
52
53
  export { default as CaseCard } from "./components/molecules/caseCard/CaseCard";
53
54
  // Contact Card
@@ -10,6 +10,7 @@
10
10
  --grey-venom: #e6edf5;
11
11
  --venom-grey-dark: #d1dce8;
12
12
  --grey-light: #f6fcfe;
13
+ --grey-light-2: #f2f8fc;
13
14
  --active-grey: #e9eef5;
14
15
  --blue-lightning: #f6fcfe;
15
16
  --fond-de-selection: #f6fcfe;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "1.0.30",
3
+ "version": "1.0.32",
4
4
  "description": "Composants UI pour l'application Allaw",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",