allaw-ui 2.9.5 → 2.9.7

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.
@@ -9,6 +9,7 @@ export interface DatepickerProps {
9
9
  yearDropdownItemNumber?: number;
10
10
  maxDaysInPast?: number;
11
11
  minDate?: Date;
12
+ disableFutur?: Boolean;
12
13
  }
13
14
  declare const Datepicker: React.FC<DatepickerProps>;
14
15
  export default Datepicker;
@@ -48,13 +48,13 @@ var CustomInput = forwardRef(function (_a, ref) {
48
48
  });
49
49
  CustomInput.displayName = "CustomInput";
50
50
  var Datepicker = function (_a) {
51
- var value = _a.value, onChange = _a.onChange, _b = _a.placeholder, placeholder = _b === void 0 ? "Sélectionner une date" : _b, _c = _a.yearDropdownItemNumber, yearDropdownItemNumber = _c === void 0 ? 10 : _c, maxDaysInPast = _a.maxDaysInPast, minDate = _a.minDate;
52
- var _d = useState(value), selectedDate = _d[0], setSelectedDate = _d[1];
53
- var _e = useState(false), isOpen = _e[0], setIsOpen = _e[1];
54
- var _f = useState({ top: 0, left: 0 }), position = _f[0], setPosition = _f[1];
51
+ var value = _a.value, onChange = _a.onChange, _b = _a.placeholder, placeholder = _b === void 0 ? "Sélectionner une date" : _b, _c = _a.yearDropdownItemNumber, yearDropdownItemNumber = _c === void 0 ? 10 : _c, maxDaysInPast = _a.maxDaysInPast, minDate = _a.minDate, _d = _a.disableFutur, disableFutur = _d === void 0 ? true : _d;
52
+ var _e = useState(value), selectedDate = _e[0], setSelectedDate = _e[1];
53
+ var _f = useState(false), isOpen = _f[0], setIsOpen = _f[1];
54
+ var _g = useState({ top: 0, left: 0 }), position = _g[0], setPosition = _g[1];
55
55
  var buttonRef = useRef(null);
56
56
  var calendarRef = useRef(null);
57
- var _g = useState("bottom"), placement = _g[0], setPlacement = _g[1];
57
+ var _h = useState("bottom"), placement = _h[0], setPlacement = _h[1];
58
58
  useEffect(function () {
59
59
  setSelectedDate(value);
60
60
  }, [value]);
@@ -146,6 +146,6 @@ var Datepicker = function (_a) {
146
146
  ReactDOM.createPortal(React.createElement("div", { ref: calendarRef, className: "datepicker-portal ".concat(placement), style: __assign({ left: "".concat(position.left, "px") }, (placement === "bottom"
147
147
  ? { top: "".concat(position.top, "px") }
148
148
  : { top: "".concat(position.top, "px") })) },
149
- React.createElement(ReactDatePicker, { selected: selectedDate, onChange: handleDateChange, locale: fr, inline: true, dateFormat: "dd MMMM yyyy", calendarClassName: "custom-calendar", showMonthDropdown: true, showYearDropdown: true, dropdownMode: "select", maxDate: new Date(), minDate: calculatedMinDate })), document.body)));
149
+ React.createElement(ReactDatePicker, { selected: selectedDate, onChange: handleDateChange, locale: fr, inline: true, dateFormat: "dd MMMM yyyy", calendarClassName: "custom-calendar", showMonthDropdown: true, showYearDropdown: true, dropdownMode: "select", maxDate: disableFutur ? new Date() : undefined, minDate: calculatedMinDate })), document.body)));
150
150
  };
151
151
  export default Datepicker;
@@ -8,6 +8,7 @@ export interface LinkProps {
8
8
  size?: "default" | "small";
9
9
  className?: string;
10
10
  onClick?: () => void;
11
+ isUnderline?: boolean;
11
12
  }
12
13
  declare const Link: React.FC<LinkProps>;
13
14
  export default Link;
@@ -13,7 +13,7 @@ import React from "react";
13
13
  import styles from "./Link.module.css";
14
14
  import { convertToHtml } from "../../../utils/utils";
15
15
  var Link = function (_a) {
16
- var variant = _a.variant, color = _a.color, text = _a.text, maxLines = _a.maxLines, maxChars = _a.maxChars, _b = _a.size, size = _b === void 0 ? "default" : _b, className = _a.className, onClick = _a.onClick;
16
+ var variant = _a.variant, color = _a.color, text = _a.text, maxLines = _a.maxLines, maxChars = _a.maxChars, _b = _a.size, size = _b === void 0 ? "default" : _b, className = _a.className, onClick = _a.onClick, _c = _a.isUnderline, isUnderline = _c === void 0 ? false : _c;
17
17
  var truncateText = function (text, maxChars) {
18
18
  if (text.length <= maxChars)
19
19
  return text;
@@ -23,7 +23,7 @@ var Link = function (_a) {
23
23
  var truncatedText = maxChars ? truncateText(htmlText, maxChars) : htmlText;
24
24
  var isClickable = typeof onClick === "function";
25
25
  var colorClassName = color ? "color-".concat(color) : "";
26
- return (React.createElement("div", { className: "".concat(styles.link, " ").concat(styles[variant], " ").concat(size === "small" ? styles["link-small"] : "", " ").concat(className || "", " ").concat(isClickable ? styles.pointer : "", " ").concat(styles[colorClassName]), style: __assign({ whiteSpace: "pre-line" }, (maxLines
26
+ return (React.createElement("div", { className: "".concat(styles.link, " ").concat(styles[variant], " ").concat(size === "small" ? styles["link-small"] : "", " ").concat(className || "", " ").concat(isClickable ? styles.pointer : "", " ").concat(styles[colorClassName], " ").concat(isUnderline ? styles.underline : ""), style: __assign({ whiteSpace: "pre-line" }, (maxLines
27
27
  ? {
28
28
  WebkitLineClamp: maxLines,
29
29
  display: "-webkit-box",
@@ -58,3 +58,9 @@
58
58
  .pointer:hover {
59
59
  cursor: pointer;
60
60
  }
61
+
62
+ .underline:hover {
63
+ text-decoration: underline;
64
+ text-underline-offset: 7px;
65
+ text-decoration-thickness: 1px;
66
+ }
@@ -31,6 +31,11 @@ declare namespace _default {
31
31
  }
32
32
  export { control_3 as control };
33
33
  }
34
+ namespace isUnderline {
35
+ let control_4: string;
36
+ export { control_4 as control };
37
+ export let description: string;
38
+ }
34
39
  namespace onClick {
35
40
  let action: string;
36
41
  }
@@ -54,4 +59,6 @@ export const BoldSmall: any;
54
59
  export const SemiBoldSmall: any;
55
60
  export const MediumSmall: any;
56
61
  export const ClickableLink: any;
62
+ export const UnderlinedLink: any;
63
+ export const ClickableUnderlinedLink: any;
57
64
  import Link from "./Link";
@@ -38,6 +38,10 @@ export default {
38
38
  options: ["default", "small"],
39
39
  },
40
40
  },
41
+ isUnderline: {
42
+ control: "boolean",
43
+ description: "Ajoute un soulignement au survol",
44
+ },
41
45
  onClick: { action: "clicked" },
42
46
  },
43
47
  parameters: {
@@ -59,6 +63,7 @@ Bold.args = {
59
63
  color: "noir",
60
64
  text: "Open Sans - Bold - 16px",
61
65
  size: "default",
66
+ isUnderline: false,
62
67
  };
63
68
  export var SemiBold = Template.bind({});
64
69
  SemiBold.args = {
@@ -66,6 +71,7 @@ SemiBold.args = {
66
71
  color: "noir",
67
72
  text: "Open Sans - SemiBold - 16px",
68
73
  size: "default",
74
+ isUnderline: false,
69
75
  };
70
76
  export var Medium = Template.bind({});
71
77
  Medium.args = {
@@ -73,6 +79,7 @@ Medium.args = {
73
79
  color: "noir",
74
80
  text: "Open Sans - Medium - 16px",
75
81
  size: "default",
82
+ isUnderline: false,
76
83
  };
77
84
  export var BoldSmall = Template.bind({});
78
85
  BoldSmall.args = {
@@ -80,6 +87,7 @@ BoldSmall.args = {
80
87
  color: "noir",
81
88
  text: "Open Sans - Bold - 12px",
82
89
  size: "small",
90
+ isUnderline: false,
83
91
  };
84
92
  export var SemiBoldSmall = Template.bind({});
85
93
  SemiBoldSmall.args = {
@@ -87,6 +95,7 @@ SemiBoldSmall.args = {
87
95
  color: "noir",
88
96
  text: "Open Sans - SemiBold - 12px",
89
97
  size: "small",
98
+ isUnderline: false,
90
99
  };
91
100
  export var MediumSmall = Template.bind({});
92
101
  MediumSmall.args = {
@@ -94,6 +103,7 @@ MediumSmall.args = {
94
103
  color: "noir",
95
104
  text: "Open Sans - Medium - 12px",
96
105
  size: "small",
106
+ isUnderline: false,
97
107
  };
98
108
  export var ClickableLink = Template.bind({});
99
109
  ClickableLink.args = {
@@ -102,4 +112,22 @@ ClickableLink.args = {
102
112
  text: "Cliquez sur moi",
103
113
  size: "small",
104
114
  onClick: function () { return console.log("Linke cliqué"); },
115
+ isUnderline: false,
116
+ };
117
+ export var UnderlinedLink = Template.bind({});
118
+ UnderlinedLink.args = {
119
+ variant: "semiBold",
120
+ color: "bleu-allaw",
121
+ text: "Survolez-moi pour voir le soulignement",
122
+ size: "default",
123
+ isUnderline: true,
124
+ };
125
+ export var ClickableUnderlinedLink = Template.bind({});
126
+ ClickableUnderlinedLink.args = {
127
+ variant: "semiBold",
128
+ color: "bleu-allaw",
129
+ text: "Cliquez et survolez-moi",
130
+ size: "small",
131
+ onClick: function () { return console.log("Lien cliqué"); },
132
+ isUnderline: true,
105
133
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "2.9.5",
3
+ "version": "2.9.7",
4
4
  "description": "Composants UI pour l'application Allaw",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",